Stocks rose on Monday as higher oil prices lifted shares of energy companies and investors bought shares to improve their holdings on the day before the second quarter draws to a close.

Crude oil futures jumped $2.33 to settle at $71.49 per barrel, boosting shares of energy companies. Exxon Mobil Corp climbed 1.7 percent to $70.19.

Fund managers are building up their portfolios before the quarter ends in a ritual known as window dressing by selling some of the quarter's losers and scooping up the winners. This bolstered stocks as well.

It's the end of the quarter (on Tuesday) so most of the funds out there might be adding on to some of their positions, said Tom Schrader, managing director of U.S. equity trading at Stifel Nicolaus Capital Markets in Baltimore.

The S&P 500 is up 16.1 percent for the quarter ending on Tuesday, despite a gain of just 0.81 percent so far in June. It could be the best quarter for the S&P 500 since the fourth quarter of 1998, when it jumped nearly 21 percent.

Shares of home builders also helped underpin the market after Credit Suisse raised its rating on KB Home , citing stronger orders and more attractive valuation. KB Home was up 5 percent at $14.08. The Dow Jones U.S. Home Construction Index <.DJUSHB> advanced 1 percent.

The Dow Jones industrial average <.DJI> was up 92.27 points, or 1.09 percent, at 8,530.66. The Standard & Poor's 500 Index <.SPX> was up 8.90 points, or 0.97 percent, at 927.80. The Nasdaq Composite Index <.IXIC> was up 8.97 points, or 0.49 percent, at 1,847.19.

An S&P energy index <.GSPE> was up 1.21 percent, while an S&P index of financial stocks <.GSPF> was up 1.08 percent. infrastructure, raising supply concerns.

Wall Street's eyes and ears also were on the news coverage of Bernie Madoff, who was sentenced to 150 years in prison on Monday for running what prosecutors called a $65 billion Ponzi scheme. When Madoff's fraud was revealed last December, its scope was so brazen and so massive that it shocked investors and made everyone question their broker.

Signs of life in overseas markets also prompted some investors to buy U.S. equities by renewing optimism about the prospects for an economic recovery.

Shanghai stocks <.SSEC> reached a one-year closing high for the fourth straight session as signs of a Chinese economic recovery and ample liquidity boosted the market, bolstering investor sentiment.

In the energy sector, Occidental Petroleum jumped 3.4 percent to $66.46. Crude oil futures rose after Nigerian militants said they attacked the country's oil facilities, which set off some concerns about supply.

On the Nasdaq, Microsoft Corp advanced 2.1 percent at $23.83 after Deutsche Bank raised its price target on the stock to $30 from $22.

On the New York Stock Exchange, Hewlett-Packard Co gained 3.6 percent to $38.97 and ranked among the Dow industrial's biggest advancers.

(Reporting by Caroline Valetkevitch; Editing by Jan Paschal)