Banner earnings from Apple, a big drugstore merger and another twist in the Federal Reserve's message on interest rates highlighted a week that produced modest gains for US stocks.
Major indices lodged their fifth straight week of gains, with the Dow Jones Industrial Average ending up 16.84 (0.10 percent) to 17,663.54.
The broad-based S&P 500 added 4.21 (0.20 percent) at 2,079.36, while the tech-rich Nasdaq Composite Index advanced 21.89 (0.44 percent) to 5,053.75.
The gains pushed major indices up more than eight percent for October, a "scary good" month after a dreadful third quarter, said Briefing.com analyst Patrick O'Hare.
However, O'Hare said the October rally lost some steam as the month progressed, shifting from a broad-based surge that lifted most stocks, to one enjoyed primarily by giants like Microsoft and Amazon.
"The scary good October rally went from a distinctly broad rally early in the month to a noticeably narrower rally by the end of the month," he said.
"It's possible the underlings could pick up some steam, but if the big guys lose their mojo, that will be a challenging proposition and most likely an invitation to scare some of the scary good October rally out of the market in the near term."
Apple had a good week, pushing aside worries about slowing momentum and reporting that fiscal fourth-quarter profits rose 31 percent to $11.1 billion behind a 22 percent increase in revenue to $51.5 billion.
Analysts were especially pleased with results from China, where revenues came in at $12.5 billion, double the level of the year-ago period and an indicator that conditions in the world's second-biggest economy are not as bad as feared.
But one of the week's most disappointing earnings reports came from micro-blogging company Twitter, which lost nearly 10 percent after it reported adding just four million monthly active users in third quarter to 320 million.
The market initially swooned at the prospects of a big merger between two big US pharmacy chains, bidding up Walgreens Boots Alliance and Rite Aid on initial reports of an imminent deal.
But investors turned on the combination after the two companies unveiled the $17.2 billion deal. Antitrust experts expect a tough once-over from US regulators.
In another sign that dealmaking remains vibrant in health care, pharmaceutical giant Pfizer and Botox-maker Allergan said they were in "friendly" merger talks.
The talks follow an unsuccessful campaign by Pfizer to acquire British company AstraZeneca in 2014. Pfizer said it still wants to shift its tax domicile overseas where tax rates are lower. Allergan is based in Ireland.
Another pharmaceutical company in the news was Canada's Valeant Pharmaceuticals International, which continued to plummet amid questions over its drug-pricing and accounting practices. Shares lost nearly 20 percent last week.
- A more optimistic Fed -
In Washington, the Federal Reserve concluded its October monetary policy meeting by keeping benchmark interest rates near zero, but gave a more positive appraisal of the US economy.
Fed policy makers expressed more faith in the strength of the economy than expected, brushing over recent weak spots and focusing on what they called "solid" consumer spending and business investment.
They also dropped a warning from September that the global downturn could affect the US, even as worries mount over China's slowdown and falling commodity prices.
The Fed's stance was seen as keeping alive the prospects of a December interest rate increase.
Yet US economic data for the week was lackluster, with the Conference Board's reading of consumer confidence dropping in October and durable goods falling in September. The Commerce Department reported that US third-quarter growth fell to 1.5 percent from 3.9 percent in the second quarter.
Peter Cardillo, chief market economist at Rockwell Global Capital, said the feeble data could work to Wall Street's advantage.
"I think the market still has room to go higher, especially with soft economic data there's more probability the Fed would hold off on raising rates in December," he said.
Fed Chair Janet Yellen will be on Capitol Hill next week for testimony before Congress. Other highlights include the October jobs report and earnings from Disney and Facebook.