Oil prices edged higher on Friday, reaching new two-month highs and posting the strongest weekly percentage gains this year as investors digested signs of an easing oversupply.
U.S. West Texas Intermediate (WTI) crude futures ended Friday's session up 67 cents, or 1.4 percent, to $49.71. It surged 8.6 percent on the week.
Brent crude futures were up $1.01, or 2 percent, at $52.50 a barrel a barrel by 2:34 p.m. (1834 GMT), rising more than 9 percent this week.
The front of the crude oil curve jumped into backwardation, with the month-ahead trading above the subsequent month, showing investors are not expecting recent gains to last. Brent also broke above its 200-day moving average, a key technical level, for the first time since May 30.
U.S. crude and gasoline inventories fell much more steeply than expected this week and the world's biggest oil exporter Saudi Arabia said it would further reduce oil output in August.
"Positive signs came from the draw in gasoline stocks this week, as the U.S. moves into the peak driving season," said Ashley Kelty, oil analyst at Cenkos Securities.
Oilfield services firm Baker Hughes reported the number of oil rigs operating in the United States rose by 2 to a total of 766 last week. The rig count has risen fairly steadily for more than a year, but the growth has recently moderated.
U.S. crude stocks fell sharply by 7.2 million barrels in the week to July 21 due to strong refining activity and an increase in exports, according to data from the Energy Information Administration (EIA).
Brimming U.S. crude supplies have been a challenge to production cuts to prop up prices led by the Organization of the Petroleum Exporting Countries, meaning weekly U.S. inventory data is closely watched.
U.S. crude oil production has been on the rise since mid-2016,but it dropped to 9.41 barrels per day (bpd) in the week to July 21, from 9.43 million bpd the week before. The decline was mainly due to a fall in Alaskan output, ANZ bank said.
Oil prices have been supported by a further agreement reached between OPEC and some non-OPEC members to limit Nigerian oil output and encourage several members to comply with their pledged production cuts.
Since the world's major oil producers held a meeting in St Petersburg on Monday, crude prices have risen some 7 percent on expectations of deepening cuts.
Saudi Arabia, the OPEC's de facto leader, said it planned to cap crude exports to 6.6 million bpd in August, about 1 million bpd below the level last year.
Despite bullish signs, some analysts' assessments of the oil market remained bearish.
"We believe the latest price rise is on a fragile footing," said analysts at Commerzbank, adding OPEC production was likely to rise in the coming months as the group has not officially capped output from members Libya and Nigeria.
— CNBC's Tom DiChristopher contributed to this report.
Correction: This story has been corrected to note that Friday is the fifth day of gains for oil futures.