U.S. stocks racked up gains across a wide array of sectors on Thursday, aided by rising commodity prices and improving labor market conditions, along with a sharp drop in interest rates.

But stocks faded late in the session as analysts said the recent pattern of light volume has made it difficult for the S&P 500 to close above the psychologically important 950 level.

Energy shares helped lead the advance after the International Energy Agency raised its demand forecast for the first time in 10 months. Crude oil surged briefly to more than $73 a barrel and lifted shares of resource companies, such as Chevron , up 2.4 percent at $71.90 and Alcoa , up 6.4 percent at $12.22. An S&P index of energy stocks gained 1.8 percent.

But energy shares weren't Wall Street's only climbers. An

upgrade of some regional banks by analysts at Goldman Sachs and a separate upgrade of Bank of America lit a fire under banking shares. The KBW bank index <.BKX> shot up 2.6 percent.

The stock market has rallied since hitting 12-year lows in early March, with the S&P rising 39.7 percent. However, stocks have failed to substantially build on those gains since mid-May, while an expected correction has yet to materialize.

Rising energy costs are now being viewed in a positive light by investors as a signal of renewed demand. Recent concerns about large debt auctions have been shrugged off, with a big rally in the bond market on Thursday as the Treasury sold $11 billion of 30-year bonds.

Isn't that typical? The more you look for something, the less likely it is going to appear, at least as far as the market is concerned, said Terry Morris, senior vice president and senior equity manager for National Penn Investors Trust Company in Reading, Pennsylvania.

That's why it keeps going up. There's a lot of worry. The market climbs a wall of worry, right?

The Dow Jones industrial average <.DJI> gained 31.90 points, or 0.37 percent, to 8,770.92. The Standard & Poor's 500 Index <.SPX> rose 5.74 points, or 0.61 percent, to 944.89. The Nasdaq Composite Index <.IXIC> added 9.29 points, or 0.50 percent, to 1,862.37.

DOW FLIRTS WITH BEING POSITIVE FOR YEAR

Earlier, the major stock indexes had gained more than 1 percent, with the Dow briefly turning positive for the year when it rose as high as 8,877.93 intraday.

Bank of America Corp shares jumped 8.3 percent to $12.97 after Keefe, Bruyette & Woods analysts raised their rating on the stock to outperform from market perform and increased their price target to $16.50 from $12.

Further bolstering bank shares, Goldman Sachs boosted its ratings on regional banks Regions Financial Corp , up 9.3 percent at $4.37 on the New York Stock Exchange, and Fifth Third Bancorp , up 5.9 percent at $7.77 on Nasdaq, although Goldman said it favored large banks overall.

Demand was well above average for an auction of $11 billion of 30-year U.S. Treasury bonds, resulting in a sharp rally in the bond market. Stocks have tracked bonds of late, with higher rates causing concern among investors, but the fall-off in bond prices, which move inversely to their yields, makes stocks more attractive.

U.S. data showed May retail sales rose 0.5 percent, but the rise was mostly due to higher gasoline prices. Excluding autos and gasoline sales, sales were up just 0.1 percent.

Weekly initial jobless claims fell to 601,000, which was better than expected, suggesting improvement in the U.S. labor market.

Boeing Co was the blue-chip Dow's primary laggard as its stock fell 3.1 percent to $50.66 after the big U.S. aircraft maker slashed its forecasts for new plane demand due to the industry downturn.

Trading volume was low on the New York Stock Exchange, with about 1.22 billion shares changing hands, below last year's estimated daily average of 1.49 billion. On Nasdaq, about 2.49 billion shares traded, above last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by 1,866 to 1,167 while on the Nasdaq, advancers beat decliners by 1,723 to 966.

(Editing by Jan Paschal)