Investors were also encouraged by a rebound in Chinese economic growth in the latest quarter.
The rise in stocks follows a budget standoff in Washington that kept hundreds of thousands of federal workers from their jobs for 16 days and could have forced the government to miss payments on its debt. Congress agreed Wednesday to fund the government and allow it to borrow through early next year.
The S&P 500 set a record for the second straight day. The broad index of 500 companies, up 22 percent this year, added 11.35 points, or 0.7 percent, to a record 1,744.50. The gain this year is the index's best since 2009, when it began its bull run. Since its recession low in March of that year, the S&P 500 has soared 158 percent, driven largely by a rebound in earnings, a housing recovery, greater investor confidence and the economic stimulus program by the Federal Reserve.
The Nasdaq composite was up 51.13 points, or 1.3 percent, at 3,914.28. The Dow Jones industrial average rose 28 points, or 0.2 percent, to 15,399.65, and is 277 points below its own record.
Christine Short, a senior manager at S&P Capital IQ, said investors are relieved that Washington pulled back from the abyss by extending the U.S. borrowing authority until Feb. 7. But she's not so sure how long the celebratory mood might last.
"We just bought ourselves a little more time, and the market seems to like that," she said. "But we're likely to go through the same cycle again in three months."
Another concern is earnings. Despite good reports from a few big companies Friday, the third-quarter reporting season has just started and most companies aren't expected to post blowout results.
Earnings for S&P 500 companies are expected to have grown 3.4 percent from a year earlier, the smallest quarterly increase in a year, according to S&P Capital IQ. At the start of 2013, third-quarter earnings were expected to grow at nearly triple that pace.
What's driven stock prices up this year hasn't been earnings as much as investors' willingness to value them more. At the start of the year, stock buyers were paying $14 for every $1 of S&P 500 earnings, according to S&P Capital IQ. Now, they are paying more than $16.
Investors will have a better idea of the U.S. corporate profit picture next week when several big companies report results, including McDonalds on Monday and Boeing and Caterpillar on Wednesday and Ford on Thursday.
Google jumped $122.61 to $1,011.41 Friday. It reported a 36 percent jump in earnings after the stock market closed Thursday. An erosion in Google's ad pricing was more than offset by a big increase in the frequency of clicks on Google's ads.
General Electric rose 87 cents, or 3.5 percent, to $25.55, after topping analysts' expectations for net income, excluding charges for shedding its media and banking operations. Stock of GE, which makes jet engines and other industrial products, is the highest it's been since the start of the financial crisis in September 2008, when some investors doubted the company could survive intact.
Morgan Stanley rose 76 cents, to $29.69, a gain of 2.6 percent. The investment bank reported that its earnings nearly doubled on strong results in stock sales and trading, beating analysts' estimates. Morgan Stanley is up 55 percent this year, the most among major banks and nearly twice the gain of the next-best performing bank stock, Citigroup.
Nine of the 10 industries in the S&P 500 rose, led by information technology companies, up 1.8 percent. Stocks in the health-care industry fell 0.4 percent.