By Edward McAllister

The gains were encouraged by a rally in U.S. stocks to a two-week high, with dealers hopeful the worst of the financial crisis that sent energy prices plummeting more than $100 a barrel since July was over.

U.S. light, sweet crude jumped $1.74 to settle at $46.34 a barrel while London Brent rose $1.32 to $46.91 per barrel.

Oil prices were down from their peaks over $147 a barrel hit in mid-July as a global economic slowdown shrinks energy demand, but a series of production cuts by OPEC since September has helped to end the slide in recent weeks.

OPEC's most recent agreement in mid-December to slash 2.2 million barrels per day from January 1 was the cartel's biggest-ever output cut, and the group's kingpin Saudi Arabia has signaled it could cut further if needed.

Adding to oil's gains Friday, fighting continued between Israel and Hamas, with Palestinian Islamists vowing to avenge the death of a senior Hamas leader. The market is watching closely to see if the fighting spreads to other areas of the Middle East.

Meanwhile, Russia, the world's biggest non-OPEC oil nation, shut off natural gas to its neighbor Ukraine on Thursday after a contract dispute, but said it had increased supplies to other European states to try to reassure its premium-paying customers.

"The OPEC cut and Saudi resolve may have put a bottom in. But this Russia-Ukraine thing is definitely a concern to European supplies," said Tom Bentz at BNP Paribas Commodity Futures Inc.

The U.S. Department of Energy said late on Friday it was seeking to purchase 12 million barrels of oil for the Strategic Petroleum Reserve in the first four months of the year and further boost the reserve through 2009.

The announcement comes after China said earlier in the week it would take advantage of lower oil prices to boost its reserves.

Oil prices fell 54 percent as a whole in 2008, from $95.98 to $44.60 a barrel at the close on December 31, with the spike to $147.27 set on July 11.

On the last trading day of 2008, prices surged 14 percent after weekly U.S. data showed a decrease in refinery activity and an unexpected 500,000-barrel rise in crude stocks in the world's biggest oil consumer.

"The recent crop of demand-side indications for oil has been rather ambiguous. In itself, that is something of a change, given a fairly long period during which the demand side numbers have been weakening fairly consistently," Barclay's Capital wrote in a note to investors.

(Additional reporting by Richard Valdmanis in Portland, Maine; Robert Gibbons in New York; Christopher Baldwin in London; and Chua Baizhen in Singapore; editing by Jim Marshall)