Stocks rallied on Friday after Microsoft's upbeat outlook boosted the three major indexes and a profit forecast from lender Countrywide Financial buoyed the struggling financial sector.

Stocks extended their gains as the weekend approached, in a sign investors are expecting the Federal Reserve to cut interest rates when it meets next week, analysts said.

Microsoft lifted its full-year forecasts late on Thursday and reported quarterly profit that beat analysts expectations. Countrywide, the largest U.S. mortgage lender, on Friday reported a quarterly loss, but it forecast a profit in the fourth quarter as it slashes jobs.

The earnings from Microsoft certainly helped, but the fact is investors are looking forward to next week, said Paul Nolte, director of investments at Hinsdale Associates, in Hinsdale Illinois. We've skated through September and October. November through May tends to be the best part of the year for stocks.

The Dow Jones industrial average was up 134.78 points, or 0.99 percent, to end at 13,806.70. The Standard & Poor's 500 Index was up 20.88 points, or 1.38 percent, at 1,535.28. The Nasdaq Composite Index was up 53.33 points, or 1.94 percent, at 2,804.19.

For the week, the Dow added 2.11 percent, the S&P 500 climbed 2.31 percent and the Nasdaq rose 2.90 percent.

Shares of Yahoo were the next biggest gainer on Nasdaq after Microsoft. The search engine is buying a big stake in, China's biggest e-commerce site. Yahoo already has a 40 percent stake in the firm's parent Alibaba Group.

Yahoo's stock jumped 7.3 percent to $33.63. Trading in bullish options on Yahoo's stock was extremely brisk.

U.S. crude futures settled at a record $91.86 a barrel, up 1.5 percent, or $1.40, on the New York Mercantile Exchange. Earlier, in electronic trading, oil reached a record high of $92.22, bumping up energy stocks.

Take a look at the commodity pits if you want to be scared, Nolte said. It's background noise today, but it may bother us on Monday.

Schlumberger was up 1.4 percent at $99.51 and Occidental Petroleum was up 2.5 percent at $70.77.

Shares of Microsoft jumped 9.5 percent to $35.03 on the Nasdaq. Earlier, the stock hit $36.03, its highest since July 2001.

Countrywide's stock shot up 32.4 percent to $17.30 and ranked among the biggest percentage gainers on the New York Stock Exchange.

Shares of Merrill Lynch & Co. Inc. jumped 8.5 percent to $66.09 after reports that Chief Executive Stan O'Neal may be on the way out. Merrill senior executive Robert McCann, who oversees the company's more than 16,000 brokers, has emerged as a possible candidate to replace the embattled O'Neal, according to people familiar with the situation.

On Wednesday, Merrill reported huge write-downs for bad investments related to risky subprime mortgages.

The New York Times reported on Friday that O'Neal met with Wachovia Corp., the fourth-largest U.S. bank, about a merger.

Speculation about a CEO exit also drove the shares of media company Time Warner up 3.6 percent to $18.35. The stock rose after the Times of London reported that Richard Parsons plans to announce his departure as soon as next week.

A Time Warner spokesman called the report a rumor.

Trading was moderate on the NYSE, with about 1.41 billion shares changing hands, below last year's estimated daily average of 1.84 billion, while on Nasdaq, about 2.58 billion shares traded, above last year's daily average of 2.02 billion.

Advancing stocks outnumbered declining ones by a ratio of about 3 to 1 on the NYSE and by about 2 to 1 on Nasdaq.

(Additional reporting by Doris Frankel)