The US benchmark West Texas Intermediate for May delivery rose two cents to finish at $38.34 a barrel on the New York Mercantile Exchange.
Brent North Sea crude for May delivery, the global benchmark, advanced 34 cents to settle at $39.60 a barrel in London deals, compared with Wednesday's close.
Prices seesawed into negative and positive territory before finishing slightly higher.
The price increase "is largely a function of the weaker dollar. The dollar is down sharply today and was at one point at a five-month low, so that's helping crude find a bid, rally into the green," said Bob Yawger of Mizuho Securities USA.
The dollar index, which measures the greenback against six other major currencies, fell 0.35 percent to 94.525 in late Thursday trade.
A weaker greenback tends to make dollar-priced commodities more attractive to buyers using stronger currencies. The dollar has declined since Yellen offered a cautious tone Tuesday on hiking US interest rates in light of a slowing global economy.
Still, analysts said the market remained focused on the global crude oversupply, which is keeping a lid on prices. The US reported Wednesday that its commercial crude oil inventories climbed last week to another record high, underscoring the supply glut.
Yawger pointed to reports that OPEC increased production in March, even as the 13-nation cartel plans to meet with non-OPEC producers next month to discuss a potential output freeze aimed at stabilizing the market. Oil prices have fallen by more than 60 percent since mid-2014.
"The rally is in the face of the April 17th meeting, so that's a bearish development and is contributing to the downside," he said.
The Organization of the Petroleum Exporting Countries and non-OPEC members will meet on April 17 in Doha to discuss the production freeze. Traders are hoping that a deal to cap output will help support crude prices.
Tim Evans at Citi Futures noted that preliminary estimates of OPEC's March output show a net increase of 100,000 barrels per day. AFP and Xinhua reported. (A026)
Editor: Tasrief Tarmizi