Oil prices closed more than 2 percent higher on Thursday on short-covering and after a modest stockpile drop at the delivery hub for U.S. crude futures.
The benchmark rose out of technical bear market, after sinking more than 20 percent from its June high in recent days as overproduction and large stockpiles of crude and refined products around the world weighed on markets.
Oil prices had seesawed throughout the morning, but moved decisively higher at midday, bouncing off technical levels as crude broke above its 200-day moving average, Again Capital founding partner John Kilduff told CNBC.
U.S. West Texas Intermediate (WTI) crude futures settled 2.69 percent higher, or $1.10, at $41.93 a barrel.
International Brent crude futures were trading at $44.25 a barrel, up $1.15. or 2.67 percent.
"With WTI testing $40 lately and without follow through selling, short positions are likely booking profits and we could see range bound prices after this," said Chris Jarvis, analyst at Caprock Risk Management in Frederick, Maryland.
It was a second straight day of gains for crude futures from April lows below $40, after Wednesday's 3 percent run-up powered by data showing a hefty U.S. gasoline inventory drawdown of 3.3 million barrels.
On Thursday, Market intelligence firm Genscape reported that stockpiles at the Cushing, Oklahoma delivery hub for U.S. crude futures fell 89,071 barrels during the week to Aug. 2, traders who saw the data said. The Genscape report came after U.S. government data on Wednesday showed a 1.1 million-barrel decline at the Cushing hub in the week to July 29.
Traders said the rally gained momentum after sources reported BP was restarting units at its 413,500-barrel per day refinery in Whiting, Indiana. The weekend outage of the reformer and blending oil unit had prompted BP to cut production by between 20 and 25 percent.
The dollar was up slightly on Thursday, remaining a non-factor to oil's moves. The U.S. currency lost 2 percent in all since late July, a development that had not boosted oil prices despite crude being denominated in the greenback.
Speculators, including hedge funds, added the equivalent of 56 million barrels of extra short positions in the three main Brent and WTI futures and options contracts in the week ending July 26, data said.
WTI's drop below $40 earlier this week had hardened the resolve of oil market bears to drive prices lower as oversupply, refining cutbacks and a breakdown in the oil/dollar trade appeared to spell an end to this year's rally.
The bullish impact of the Genscape report was muted somewhat by data from Iraq's state oil marketer which said the OPEC member's July crude production was at its highest since January at 4.6 million barrels per day.
Stockpiles of middle distillates in Singapore were at a five-year high year, also adding to worries of a worldwide petroleum glut.
"Onshore inventories are high for sure and the supply-demand suggests that the builds will be large in crude, which could test onshore tank tops," said Scott Shelton, ICAP energy futures broker in Durham, North Carolina.
Aside from the global inventory situation, U.S. government data on Wednesday showed crude stockpiles rose 1.4 million barrels last week, versus analysts' expectations for an identical draw.
With overall oil market conditions still weak, and production overhangs in both crude and refined products continuing to weigh, traders said Wednesday's and Thursday's price rises would likely be reined in.
"Our long standing WTI-Brent targets of $37-38 remain as high probability and position type shorts represent a hold," said Jim Ritterbusch of Chicago-based oil markets consultancy Ritterbusch & Associates.
— CNBC's Tom DiChristopher contributed to this story.