Oil fell slightly on Friday as investors booked profits at the end of a fourth consecutive week of gains, but prices remained close to 2016 highs on expectations of a production freeze by major exporters.
U.S. crude was down 10 cents at $40.10 barrel, after rising to as high as $40.55 -- higher than the previous peak of $40.36 reached on Thursday. The benchmark had surged 4.5 percent to close at $40.20 in the previous session.
Oil prices have climbed by more than 50 percent from 12-year lows reached in December, bolstered as the Organization of the Petroleum Exporting Countries (OPEC) floated the idea of a production freeze, boosting Brent from about $27 and U.S. crude from around $26.
Many analysts think there is still steam in the rally.
"There is continuing jaw-boning about production cuts from OPEC members and inventories are now coming in at the lower end, rather than the higher end of expectations," said Michael Hewson, chief market analyst at CMC markets.
Crude inventories in the United States increased by 1.3 million barrels in the week to March 11, to a record high of 523.2 million barrels, though that was a much smaller build than the 3.4 million barrels expected by analysts, the Energy Information Administration said on Wednesday.
U.S. oil is heading for a fifth week of gains, while Brent is on course for a fourth weekly increase, the longest rising streak in about a year for both benchmarks.
Other analysts, however, urged caution after the strong gains.
"Global fundamentals are little changed and oil has instead been lifted by higher risk-appetite," BNP Paribas said in a note. "A dialogue among key producing countries to address oil output will at best yield a decision to freeze output, but not the much-needed reduction required to rebalance the market."
BNP estimates that there will be a 1 million barrel increase in global stocks by the end of the first half of 2016.
OPEC kingpin Saudi Arabia and non-OPEC producers led by Russia will meet on April 17 in the Qatar capital Doha in an effort to agree the first global supply deal in 15 years.