Crude futures relinquished early gains ahead of the session's close on Monday as a global supply glut continued to cap gains while traders took profits after oil's earlier push higher.
U.S. crude closed up 27 cents, or 0.5 percent, at $51.91 a barrel. The contract rose to a session high of $53.10, which is just below its 100-day moving average at $53.18. It has not been above that key technical level since July 2014.
Front-month Brent crude was up 45 cents at $58.30 a barrel, having swung between $57.46 and $59.54.
Prices rose initially on concerns about turmoil in Yemen, the slowdown in U.S. drilling, and renewed expectations that it Iran would not be able to quickly add supply to the market if a deal is reached on Tehran's nuclear program.
The chief economist at the International Energy Agency, Fatih Birol, on Monday said it may take Iran three to five years to affect oil supplies. Oil growth may "surprise" this year, Birol said, noting that higher demand and lower supplies may put upward pressure on prices.
Weak export data from China raised concerns about the economy of the world's no. 2 oil consumer but also fueled hopes for economic stimulus along with data that showed China's crude oil imports were up 14 percent in March versus a year ago, though imports fell from February.
"Another case of bad news possibly being good news, since more stimulus for China would lead to more demand," said Phil Flynn, analyst at Price Futures Group in Chicago.