Brent crude futures gained 85 cents to settle at $79.28 a barrel, while U.S. crude futures gained 18 cents to settle at $71.49 a barrel.
"We rallied as the day went on," said Gene McGillian, manager of market research at Tradition in Stamford. "We continued to receive support from concerns about supply from the Iranian nuclear accord, Venezuela ... as well as the draw in crude," McGillian said.
U.S. crude inventories <USOILC=ECI> fell by 1.4 million barrels in the week to May 11, compared with analyst expectations for a 763,000 barrel decrease. [EIA/S]
U.S. gasoline stocks fell 3.79 million barrels, according to the U.S. Energy Information Administration's weekly report. Analysts had expected a 1.42 million barrel decline. That helped push gasoline futures to their highest levels since October 2014.
"The strength of gasoline, which made new highs, a 3-1/2-year high today ... helped pull up crude later in the session," said Jim Ritterbusch, president of Ritterbusch and Associates in Galena, Illinois.
Exports hit a new one-week record, the EIA said.
The report pointed to healthy demand for U.S. crude, Commerzbank analyst Carsten Fritsch said.
In Venezuela, production plunged to 1.5 million barrels last month, its lowest level in decades due to its ongoing economic crisis.
Meanwhile, the dollar <.DXY> firmed to nearly a five-month high against a basket of other major currencies on Wednesday. A stronger greenback makes it more expensive to buy dollar-denominated commodities such as oil.
While futures prices climb, physical crude markets are sagging under the weight of unsold barrels. The 50 percent rise in oil prices in the last year is encouraging major companies such as ExxonMobil, Royal Dutch Shell, Chevron, BP and Total to increase output.
Spot crude oil cargo prices are at their steepest discounts to futures prices in years as sellers struggle to find buyers for West African, Russian and Kazakh cargoes, while pipeline bottlenecks trap supply in West Texas and Canada.
The International Energy Agency warned global demand is likely to moderate this year as crude prices near $80 a barrel and many key importing countries no longer offer consumers generous fuel subsidies.
In its monthly report, the Paris-based IEA cut its forecast for 2018 global demand growth to 1.4 million barrels per day, from 1.5 million bpd. [IEA/M]
"On balance, the report is tending more to the negative side. Demand for oil has been revised downwards for the second half of the year from April," PVM Oil Associates strategist Tamas Varga said.
(Additional reporting by Amanda Cooper in LONDON and Henning Gloystein in SINGAPORE; Editing by Mark Potter, Paul Simao and Susan Thomas)
By Ayenat Mersie