The S&P 500 advanced 0.2 percent to 2,857.05 and is now just under 0.6 percent from its record reached in January. The Dow Jones Industrial Average climbed 89.37 points to close at 25,758.69 with Nike outperforming. Nike shares rose 3.1 percent after Piper Jaffray upgraded the athletic apparel maker to overweight from neutral and raised their price target to $93 a share from $72. The stock traded around $82 per share.

The bull market turns 3,453 days old this Wednesday. Barring a 20 percent decline between now and then, it would mark the longest bull market in history, according to S&P.

Since the current bull market started on March 9, 2009, the S&P 500 has surged more than 300 percent.

"The length of this bull market is unprecedented but so was the decline we saw," said Shannon Saccocia, CIO at Boston Private. "The depths of the decline were really unprecedented; that's really an outlier." The current bull market started after the financial crisis.

PepsiCo agreed to buy SodaStream for $3.2 billion, or $144 per share. The agreed price per share represents a 10.9 percent premium from SodaStream's closing price of $129.85 on Friday. The deal is expected to close by January. SodaStream shares rose about 9.4 percent.

"M&A is always a positive for the market. It shows corporations are not worried about the economy faltering," said Peter Cardillo, chief market economist at Spartan Capital Securities.

Equities closed a volatile week on Friday on a high note. The Dow rose more than 100 points while the S&P 500 and Nasdaq also logged in some gains. Stocks got a boost after a report said President Donald Trump and Chinese leader Xi Jinping hope to discuss U.S.-China trade in November.

"Perhaps it's time to stop using the adjective 'escalating' to describe the trade war," said Ed Yardeni, president and chief investment strategist at Yardeni Research. "What if this all leads to less protectionism once the fog of war clears? This possibility sure helps explain why the US stock market has performed so well so far this year."

Facebook's stock slipped 0.8 percent after Reuters reported the U.S. government is trying to force the company to break its encryption on the Messages app.