Oil prices edged higher on Wednesday, as surging U.S. fuel demand offset data from the Energy Department that showed crude inventories did not fall as much as expected last week.
Crude inventories in the United States fell by 1.5 million barrels in the week to July 28, the Energy Information Administration said, about half the decline analysts had expected.
However, the report also showed estimated weekly gasoline demand at a record high 9.842 million barrels.
U.S. West Texas Intermediate (WTI) crude ended Wednesday's session up 43 cents, or 0.9 percent, to $49.59 per barrel, after falling to a low of $48.55 earlier in the session.
Brent crude, the international oil benchmark, was up 60 cents, or 1.2 percent, at $52.38 per barrel by 2:28 p.m. ET (1837 GMT), after hitting a session low of $51.18.
Strong refinery runs continued to boost demand for crude. Refinery crude runs rose by 123,000 barrels per day last week, EIA data showed.
"I would expect the bulls to re-assert control over the market after the initial knee-jerk lower," David Thompson, executive vice president at Powerhouse, an energy-specialized commodities broker in Washington.
"Despite the week-to-week move lower in distillate demand, comparing the rolling four-week average of this year to last, distillate demand is running a whopping 14.5 percent over the same period last year."
HollyFrontier Corp said it plans to run its five refineries at or slightly above their combined capacity of 457,000 barrels per day (bpd) in third quarter.
Petromatrix strategist Olivier Jakob said Wednesday's price rise had more to do with technical trading than fundamentals.
"We are trading around the 200-day moving average and I think that is where a lot of the action of the last two days has been," Jakob said.
Brent futures fell below their 200-day moving average on Monday, but by Wednesday managed to vault above this trendline, last around $51.84 a barrel.
Oil prices fell sharply on Tuesday, and have come under pressure in recent sessions on news top oil producing countries may be boosting output.
OPEC oil output rose in July to a 2017 high, a Reuters survey found, led by a further recovery in supply from Libya, one of the countries exempt from a production-cutting deal. Iran's oil exports also increased.
Russia's oil output stood at 10.95 million barrels per day (bpd) in July, unchanged for a third month and in line with its pledge to curb production, government data showed on Wednesday.
Energy consultancy Douglas Westwood predicted that the oil market glut will return next year and last until 2021.
"Oversupply will actually return in 2018. This is due to the start-up of fields sanctioned prior to the downturn," said Steve Robertson, head of research for global oilfield services at Douglas Westwood.
— CNBC's Tom DiChristopher contributed to this report.