U.S. oil prices closed higher Wednesday in seesaw trading, as strong U.S. gasoline demand offset worries over record high crude stockpiles.
U.S. government data showed crude stockpiles rose 3.5 million barrels last week to reach an all-time peak above 507 million barrels.
But U.S. gasoline demand over the past four weeks rose more than 5 percent compared with a year ago, and inventories of the motor fuel also slid from record highs on lower refinery runs.
Brent crude was up $1.21 at $34.48 a barrel. U.S. crude settled at $32.15 a barrel, up 28 cents, or 0.88 percent, after falling more than 4 percent at session lows. Both dropped more than 5 percent in intraday trading on Tuesday.
"It's a mixed bag for both bulls and bears as crude stocks continue to rise while gasoline and distillate stocks dropped," said Chris Jarvis, analyst at Caprock Risk Management in Frederick, Maryland.
But some traders bet prices will head back lower after Saudi Oil Minister Ali al-Naimi on Tuesday ruled out production cuts, although more major producers were likely to join a Saudi-Russia deal to freeze output at January's highs.
Iran, which opposes any move to limit its oil output until its crude exports reach pre-sanction levels, called the deal "laughable."
Oil has slid from more than $100 a barrel in mid-2014, pressured by excess supply and a decision by the Organization of the Petroleum Exporting Countries to abandon its traditional role of cutting production to boost prices.
OPEC and outside producers have stepped up diplomatic activity after prices slumped to their lowest since 2003 last month. OPEC and non-OPEC producers, who support the idea of a production freeze, are planning a mid-March meeting, Venezuela's Oil Minister said.
"We feel it's just a matter of time before we break below $30 to the downside," said Tariq Zahir, fund manager at New York's Tyche Capital Advisors, who is wagering that nearby U.S. crude futures will weaken versus forward contracts in coming days and weeks.
"The talk of a bottom having formed in crude prices will be proven wrong again for the umpteenth time," Zahir said.
Crude inventories in the U.S. Gulf Coast refining hub rose to the highest on record since at least 1990. But gasoline stockpiles fell for the first time since early November after some refineries cut back production in response to low margins.
"The crude oil inventory situation is set to worsen by a lot, given the sub-85 percent refinery run rate," said John Kilduff, partner at New York energy hedge fund Again Capital.
In addition to strong gasoline demand, Kilduff said crude prices seemed to be bouncing off a technical level just below $31.
— CNBC's Tom DiChristopher contributed to this report.