* Asian shares gain for 2nd day on resource-related firms
* Oil dips below $40 but Middle East uncertainty remains
* Nikkei drops 42 pct in 2008; worst year on record
* JGB 10-yr yield hits 5-year low, Treasuries up (Updates with latest prices, European outlook, new byline)
By Rafael Nam
HONG KONG, Dec 30 (Reuters) - Asian shares advanced for a second consecutive session on Tuesday, led again by resource firms that could benefit from a sharp rebound in oil prices as Israel continued its attacks on Islamic group Hamas.
Oil and gold gave up some of their recent gains, though analysts said prices could be underpinned in the short-term by the uncertainty in the Middle East.
Those developments are also extending a rally in safe-haven government bonds, while hitting the U.S. dollar on worries about oil supplies.
European shares were also set to rise, as most of the region's bourses head into the last full-day session of 2008.
Trading was choppy ahead of the end of a year of unprecedented milestones. Japan's Nikkei average wrapped up 2008 on Tuesday, having posted its worst year on record after the financial crisis and surging yen drove the world's second-largest economy into recession.
Still, 2008 is also ending with some measure of optimism that the worst may be behind, as those central banks that can are expected to continue slashing rates, while stimulus and spending measures could begin to revive anaemic global growth.
"2008 was the year of the serpent, everyone got bitten," said Paul Biddle, a fund manager with Souls Funds Management in Australia.
"Next year has got to be better than this year. It's going to be a tough year ... but there will be some comeback in the market," he said.
The MSCI index of Asia-Pacific stocks outside Japan rose 0.6 percent as of 0640 GMT following a continued rally in resource shares such as Chinese offshore oil producer CNOOC.
The index is still down more than 50 percent for 2008, on track for its worst year on record, although the index has risen more than 25 percent since a five-year low hit in late November.
Helping drive the rally has been the measures undertaken by policy makers worldwide.
The U.S. government on Monday expanded its bailout of the auto industry with $6 billion in support for General Motors' finance arm, while a Japanese newspaper said the country is considering a $110 billion scheme to buy bad loans and other financial assets from banks.
Signs are also emerging that foreign investors are coming back to Asia. South Korea's main index experienced its first month of net foreign buying in six months in December.
Still, the stream of bleak economic data continues unabated after South Korea said industrial output in November registered its biggest monthly percentage drop since August 1987.
South Korea's KOSPI pared gains following its industrial output data, though it still ended up 0.6 percent, while Australia's main index rose 0.9 percent.
Japan's Nikkei average climbed 1.3 percent to a seven-week peak in a holiday-shortened session, but fell 42 percent in 2008.
Taiwan's main index jumped 3.9 percent on a media report that some local banks may set up branches in China by the end of 2009. Hong Kong shares rose 1.1 percent.
Shares in Shanghai and Singapore bucked the trend with falls.
OIL STEADIES
Oil prices fell 58 cents to $39.44 a barrel as some of the concerns over global demand overshadowed Middle East crude supply fears. Crude remains more than $100 below the peak of a little under $150 hit in July.
Israeli warplanes killed 10 Palestinians on Tuesday in attacks targeting government buildings and other symbols of Hamas in the fiercest air offensive in Gaza in four decades, stirring concerns about Middle East energy supplies.
Gold, traditionally a safe-haven, also pared some gains to steady at $873.75 an ounce after having rallied as much as 24 percent in 2008.
The dollar lost more ground as the Middle East troubles sparked buying of the Swiss franc and euro. The U.S. currency has fallen over the past several months as the extreme aversion to risk has relented and U.S. investors have slowed some of their big repatriation of overseas investments.
The euro climbed 1 percent to $1.4114. The dollar also declined 0.8 percent against the Swiss franc to 1.0525 francs, and slipped 0.3 percent to 90.26 yen.
Government bonds rose as investors appear to want some peace of mind over the New Year's holidays.
The benchmark 10-year Japanese government bond (JGB) yield fell 3.5 basis points to 1.165 percent after earlier hitting a five-year low of 1.155 percent.
For the year 10-year JGB yields have fallen 33.5 basis points, the biggest yearly drop since 2002 -- when Japan was last mired in recession and suffering from deflation.
U.S. Treasuries also climbed. The benchmark 10-year note was up 13/32 in price to yield 2.069 percent, and is likely to post the biggest annual yield drop since 1995. (Additional reporting by Eric Burroughs in HONG KONG and Denny Thomas in SYDNEY; Editing by Lincoln Feast)