Updated from 2:40 p.m. EDT

Crude oil prices closed sharply higher Wednesday, having declined in the three previous sessions, as two reports showed a decline in energy inventories.

The benchmark U.S. crude added $1.61, or 4%, to $41.15, its highest close in six weeks and about a dollar shy of its record high touched in early June. Gasoline prices jumped 3 cents, or 2.4%, to $1.316 a gallon.

Both the American Petroleum Institute and the Department of Energy said crude stockpiles fell -- to varying degrees -- in the most recent week, but differed on the direction of gasoline stocks. The API said gasoline inventories rose, while the DOE said they fell in the week ended July 9.

Though prices had slipped in recent days, the decline has been modest as traders remain concerned about short-term supplies.

Prices briefly closed above $40 last week, as traders worried about production in Russia and Iraq as well as the possibility of new terror attacks against the U.S. ahead of the presidential election.

Russia's biggest oil company, Yukos, is embroiled in a tax dispute with Moscow and there's speculation -- under a worst-case scenario -- that the company might be forced into bankruptcy if pressed to make a massive payment. Yukos is now trying to settle the case.

Meanwhile, Iraq continues to struggle in keeping exports at a reliably consistent level following sabotage attacks and other problems with pipelines feeding southern export facilities.

Prices have jumped as much as $6 this month, after closing below $36 a barrel for the first time in three months.

The Organization of Petroleum Exporting Countries is scheduled to meet July 21 to decide on an increase in its production ceiling of half a million barrels a day in August. The measure was part of a broader agreement reached at OPEC's June meeting, when it decided to increase official production by two million barrels a day in July.

At one point recently, oil prices had fallen 15% from their record high of more than $42 a barrel, which was reached the day before OPEC's June 3 meeting.

During May, traders bid up prices on short-term supply concerns triggered by strong global demand and terrorist attacks on oil industry personnel and facilities in the Persian Gulf region ahead of the peak summer driving season in the U.S. and Europe.