Gold set record highs for a second straight session on Wednesday as investors bought the precious metal due to fears the dollar may weaken further, bringing inflation.

Bullion has gained nearly 20 percent this year, helped by dollar weakness and inflation worries after central banks and governments across the globe poured billions of dollars into the financial system to revive growth.

Spot gold hit a historic $1,048.20 an ounce, and was last at $1,041.75 an ounce by 1:17 p.m. EDT, versus $1,040.85 quoted late in New York on Tuesday.

At the COMEX division of the New York Mercantile Exchange, gold for December delivery closed up $4.70 to $1,044.40 an ounce, after dealing in a session range between $1,037.80 to $1,049.70, a new all-time record high.

Other precious metals also rose, with palladium hitting $313.50 an ounce, its highest level since August 2008. Platinum rose to a two-week high and silver to a three-week high.

The dollar swung into positive territory, clipping gold's gains along with technical resistance at $1,050 per ounce. Still, analysts said momentum should remain in the market's favor.

When the market moves this much in the space of two days, you have to expect it to pause for breath. But we don't see too many signs of people looking to bail out and take profits here, said Tom Kendall, metals analyst at Mitsubishi Corp in London.

Daniel Sacks, Co-Portfolio Manager of the Investec Global Gold Fund, said gold prices were set to test new highs as the fourth quarter progresses.

We believe it should continue to perform well against most assets into the final quarter of 2009. Moreover, the price of gold is still just over half of its prior peak in real terms, even after the rally of the past eight years, he said in a note to clients.

Metals consultancy GFMS has put the inflation-adjusted peak for gold as high as $2,079 an ounce.

WEAKER PHYSICAL DEMAND?

Gold's rally has boosted flows into exchange traded funds (ETF). The world's largest gold-backed ETF, the SPDR Gold Trust, said its holdings stood at 1,100.514 tonnes as of October 6, up 0.2 percent or 2.441 tonnes from the previous business day for the third consecutive day of increase.

But high prices should curb demand for physical gold, some analysts said, which could make it hard to sustain the rally.

Renowned investor Jim Rogers, one of the biggest bulls on this decade's commodities rally, is not so bullish on gold a day after the precious metal set a record high, although he does see further gains in the long term.

Silver rose to $17.55 an ounce, its highest since September 17, and was last at $17.46 an ounce versus $17.32 an ounce last quoted in New York on Tuesday.

Platinum climbed to $1,338 an ounce, its highest since September 23, and was last at $1,319 an ounce from $1,313.50 an ounce.

(Additional reporting by Christopher Kelly in New York and Veronica Brown in London; Editing by David Gregorio)