Updated from 1:38 a.m. EST

Oil prices erased early losses to close slightly higher Friday, as the benchmark U.S. crude flirted with the $52 level for the second session in a row.

The April futures contract added 10 cents to $51.49, a new four-month high, in Nymex floor trading. Prices Thursday hit a 2005 intraday high of $52.05 in a volatile session driven by the release of U.S. energy inventory data.

The data showed a 600,000-barrel increase in crude stocks and a 700,000 rise in distillate supplies, which include heating oil. Neither increase was enough to cool market bulls. Gasoline stocks jumped by 1.8 million barrels.

Prices are at their highest level since late October amid unseasonably cold weather in the U.S. and worries about OPEC's production plans. OPEC next meets on March 16 in Iran.

Demand for heating oil is usually a diminishing factor for the market at this time of year, but colder-than-normal weather has extended the peak heating season.

Prices hit a record high of more than $55 in late October, but then fell by as much as 25% before moving back up.