Brent crude was on track for its third weekly gain on Friday, supported by an optimistic report from the International Energy Agency (IEA) that said the market may have reached its bottom.
Still, analysts cautioned that a large glut of oil remained, with Goldman Sachs warning that US crude could saturate storage in the coming months.
US crude futures were trading at $38.64 a barrel, up 80 cents from their last close, having hit a 2016 high of $38.96 earlier in the day.
Brent crude futures were at $40.65 a barrel, up 60 cents, and on track for their third weekly gain in a row.
Both contracts were trading more than 45% higher than the lows plumbed earlier this year.
The IEA said in a monthly report that oil might have bottomed and that low prices were beginning to impact crude output outside producer organisation OPEC.
More From This Section
"There are clear signs that market forces are working their magic and higher-cost producers are cutting output," the Paris-based IEA said.
The group, which coordinates energy policies of industrialised nations, said it believed non-OPEC output would fall by 750,000 barrels per day (bpd) in 2016 up from its previous estimate of 600,000 bpd.
It also said Iran's post-sanctions return to exporting was happening more gradually than expected, keeping its barrels from putting significant pressure on the market.
Still, Iran said this week it would not participate in any output freeze until it had regained market share.
Industry sources also told Reuters on Friday that oil resumed pumping from Iraq's Kurdistan to the Turkish port of Ceyhan. The pipeline's closure in mid-February had taken some 600,000 barrels per day (bpd) out of the market.
Earlier in the day, support also came from a global weakening of the US dollar.
The greenback fell after easing measures announced by the European Central Bank. A weaker dollar supports oil prices as it makes dollar-traded oil cheaper for countries such as China, potentially spurring fuel demand.
The IEA said it nevertheless saw global oil and product stocks rising heavily in the first half of 2016, in the range of 1.5-1.9 million bpd, but that would slow to 0.2 million bpd in the second half. The excess itself led some to warn that a premature price recovery could hamper market rebalancing.
"We reiterate our view that oil prices need to remain low for longer, as the oil and capital market rebalancing are only beginning," Goldman said in its report.