Oil prices were driven 2 percent higher by an ongoing rally in the U.S. stock market on Thursday, although gains were capped by plentiful supplies and bulging inventories in spite of efforts by producers to cut output.
U.S. crude popped to a peak of $54.06, its highest in more than three weeks, as Wall Street opened at 9:30 a.m. ET and added to the previous session's rally that had lifted the Dow Jones Industrial Average to close above 20,000 for the first time. Major averages were little changed in the afternoon.
Robert Yawger, director of energy futures at Mizuho Americas, said traders may keep be adding more long positions in oil that are already at two-and-a-half-year highs.
"The market is pushing for $55 oil here and ultimately it seems determined to get there," Yawger said. "The speculators have an interest in pushing this thing to the upside, which has much do with this (rally) as anything else."
The dollar index was also up 0.4 percent, but its recent weakness — it has lost about 3 percent since peaking in January — has also supported oil.
Oil is traded in the U.S. currency and a weaker dollar makes fuel purchases less costly for countries using other currencies, potentially spurring demand.
Oil's gains were held back by Wednesday's weekly U.S. inventory figures, which showed an increase of 2.8 million barrels last week in U.S. crude inventories to 488.3 million barrels, pointing to ample supply in the world's biggest market.
Gasoline inventories rose sharply, putting current stocks at 253 million barrels, highest of the century for this time of year. That has caused refining margins to wither; the U.S. refined product crack spread has fallen to $12.79 a barrel, lowest since November.
U.S. crude oil production has risen by 6.3 percent since the middle of last year to 8.96 million barrels per day (bpd).
"Crude oil and other liquids inventories grew by 2 million bpd in the fourth quarter of 2016, driven by an increase in production and a significant, but seasonal, drop in consumption," the agency said.
The two benchmark crudes have stayed within fairly narrow trading ranges since OPEC agreed to limit production.
"We still believe there are more arguments in favor of prices breaking out of their current corridor and embarking on a downward trajectory," said Carsten Fritsch, senior commodities analyst at Commerzbank in Frankfurt.
Rising U.S. output and inventories are likely to limit the impact of the agreement by the Organization of the Petroleum Exporting Countries and other producers, including Russia, to cut supplies in an effort to reduce a global glut.
OPEC and other exporters have said they will reduce output by almost 1.8 million bpd during the first half of 2017. Industry data suggest many of those cuts have already been made.
But key customers in Asia are being spared any significant cuts because producers fear losing market share to competitors.
Saudi crude supplies to Japan will not be reduced, a senior Saudi official said on Thursday.
— CNBC's Tom DiChristopher contributed to this report.