
Oil prices were higher on Wednesday after government data showed a bigger-than-expected drop in gasoline inventories and falling weekly U.S. crude output.
U.S. West Texas Intermediate (WTI) crude futures ended Wednesday's session up 50 cents, or 1.1 percent, at $44.74 per barrel. Brent crude futures were up 69 cents, or 1.5 percent, at $47.34 per barrel at 2:35 p.m. ET (1835 GMT), close to their last close.
Crude inventories rose by 118,000 barrels in the week to June 23 as refineries cut output.That compared with analyst expectations for an decrease of 2.6 million barrels.
A report by the American Petroleum Institute on Tuesday had suggested inventories rose by 851,000 barrels, which prepared traders for a possible surprise increase.
Meanwhile, gasoline stocks fell by 894,000 barrels, compared with analysts' expectations in a Reuters poll for a 583,000-barrel drop, EIA said.
Despite the drop in gasoline stockpiles, implied demand for gasoline fell by 278,000 barrels a day last week, continuing a streak of weak consumption.

Weekly oil production declined by 100,000 barrels per day to 9.3 barrels per day, EIA reported.
The "most interesting thing is crude oil production was down ... which is a significant decline given the increases in previous weeks," Andrew Lipow, president of Lipow Oil Associates in Houston, said.
Lipow said production was most likely pressured by a storm in the Gulf of Mexico last week. The production decline came after U.S. output reached almost 9.4 million bpd during the prior week, the most since August 2015.
Continental Resources CEO Harold Hamm on Wednesday told CNBC's "Squawk Box" current oil prices are not sustainable. A dip below $40 a barrel would cause drillers to rein in production, he said.
Some analysts believe the recent sell-off was overdone.
Ian Taylor, head of the world's largest independent oil trader Vitol, said Brent will stay in a range of $40-$55 a barrel for the next few quarters as higher U.S. production slows a rebalancing of the market.
Analysts at JBC Energy in a report saw room for prices to recover.

"While the physical crude market remains steady at best, it is worth noting there is now significant room for speculative support for prices to develop if a catalyst were to emerge," JBC said.
Still, global supplies are still ample despite the output cuts by the Organization of the Petroleum Exporting Countries and other producing countries of 1.8 million barrels per day (bpd) from January 2017.
OPEC and the other producers, trying to reduce a crude glut, agreed in May to extend the supply cut through March 2018. Still, crude prices have been pressured on rising production from the United States and from Nigeria and Libya, two OPEC members exempt from cutting output.
Crude oil exports from a number OPEC members, including Saudi Arabia, are on the rise in June, according to analysis of tanker ship loadings by shipment tracking firm ClipperData.
OPEC delegates have said they will not rush to cut crude output further or end the exemptions, although a meeting in Russia next month is likely to consider further steps to support the market.
— CNBC's Tom DiChristopher contributed to this report.