Updated from 2:04 p.m. EDT

Energy prices erased early losses and closed sharply higher Wednesday, after snapping a four-session run of record highs Tuesday, as the latest inventory figures failed to ease supply concerns.

In the morning, the Department of Energy said oil inventories were down 1.1 million barrels, or 0.4%, for the week ended May 14 but gasoline production was up 1.2 million, or 0.6%. Imports rose by 980,000 barrels, or 1%, the report said.

Market reaction was initially tepid, given traders' recent fixation on gasoline supplies, but as the session wore on, the modest increase in gasoline inventories was taken as a bullish sign by speculators.

The benchmark U.S. crude gained 96 cents, or 2.4%, to $41.50, shy of last week's record high.

Gasoline futures, however, hit another new high, surging more than 6 cents, or 4.6%, to $1.45 a gallon, following a sharp drop yesterday.

Traders also focused on emerging worries about natural gas supplies because of forecasts for unseasonably hot weather this weekend and a Caribbean storm that may be headed toward the Gulf of Mexico, a major production zone.

Energy prices have repeatedly hit record highs lately, as traders worry about supply because of the recent attacks on production facilities in the Middle East and the approach of the peak summer driving season. Crude oil prices last week closed above $41 for the first time in the history of trading on the New York Mercantile Exchange, surpassing the previous high set in October 1990 when Iraq occupied Kuwait.

Saudi Arabia recently called on the Organization of the Petroleum Exporting Countries to increase production by about 6% to head off any possible damage to world economic growth, but traders have largely discounted any benefit from that because cartel members are already producing above their official quotas.

OPEC will meet later this week with key oil-consuming nations to discuss market conditions.