UPDATE 8-Oil prices gain as record gasoline demand offset disappointing crude data


* U.S. crude stockpiles fall last week-EIA

* Russia sticks to global oil deal, July output flat on month

* OPEC output at 2017 high of 33 mln bpd

* Oversupply to return, to last for years -Douglas Westwood (New throughout, adds EIA data, Russia output, comments, changes dateline to NEW YORK; previous LONDON)

NEW YORK, Aug 2 (Reuters) - Oil prices gained in choppy trading, as soaring refined product demand overshadowed data from the U.S. 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, half the amount that analysts had expected of 3 million barrels.

Estimated gasoline demand data included in the report, however, showed demand at 9.842 million barrels in the week, the highest on record.

Brent crude futures were up 0.6 percent, or 31 cents, at $52.09 a barrel by 11:38 a.m. EDT (1538 GMT), after hitting a session low of $51.18.

U.S. West Texas Intermediate crude rose 0.4 percent to $49.36 a barrel, after falling to a low of $48.55 earlier in the session.

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.

"Refiners continue to run at a high rate to capture strong crack spread margins and this will continue to underpin demand for crude."

Both contracts fell sharply the previous day after Royal Dutch Shell said its 400,000-barrels-per-day (bpd) Pernis refinery in the Netherlands would remain offline for at least the next couple of weeks following a fire.

Oil prices have come under pressure in recent sessions on news top oil producing countries may be boosting output.

OPEC oil output rose in July by 90,000 barrels per day (bpd) 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 in July increased by 45,000 barrels per day (bpd) versus June, the oil ministry's news agency SHANA reported.

However, 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 in an effort to support the price of crude, Energy Ministry data showed on Wednesday.

Petromatrix strategist Olivier Jakob said Wednesday's price recovery had more to do with technical trading than outright fundamentals, which had encouraged traders and investors to buy crude futures.

"There are some technical battles out there today. 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 through their 200-day moving average on Monday, but by Wednesday managed to vault above this trendline, which was last around $51.84 a barrel.

Energy consultancy Douglas Westwood reckons this year's oil market will be slightly undersupplied but that the 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.

(Additional reporting by Amanda Cooper in London, Henning Gloystein in Singapore; Editing by Bernadette Baum)