Technology and health stocks led the benchmark S&P 500's major sectors. Merck & Co Inc (>> Merck and Company) was the biggest boost to the Dow, while gains in Apple shares led the Nasdaq index.

Stocks climbed after Trump's new economic adviser Larry Kudlow told CNBC that the president may be open to forming an international coalition to grapple with trade issues involving China.

Investors will look for further signs of China's stance on trade relations when Chinese President Xi Jinping speaks at the Boao Forum economic conference on Tuesday.

But stocks began paring gains late in the afternoon, a downward trend that accelerated after a report that the FBI had raided the New York office of Michael Cohen, Trump's personal lawyer, upon a referral by Special Counsel Robert Mueller.

"Even if it ultimately ends up being nothing, the initial reaction is almost always negative in the market," said Randy Frederick, vice president of trading and derivatives for Charles Schwab in Austin, Texas.

Investors are looking forward to the start of earnings season to provide a sustained lift to U.S. stocks, with big banks, such as JPMorgan Chase (>> JP Morgan Chase & Company), Citigroup and Wells Fargo, set to report first-quarter results on Friday.

Analysts expect quarterly profits for S&P 500 companies to rise 18.5 percent from a year ago, which would be the biggest gain in seven years, according to Thomson Reuters I/B/E/S.

The Dow Jones Industrial Average <.DJI> rose 46.34 points, or 0.19 percent, to 23,979.10, the S&P 500 <.SPX> gained 8.69 points, or 0.33 percent, to 2,613.16 and the Nasdaq Composite <.IXIC> added 35.23 points, or 0.51 percent, to 6,950.34. AveXis Inc rose 81.6 percent after Swiss drugmaker Novartis offered to buy the gene therapy company for $8.7 billion.

Merck shares rose 5.2 percent after the drugmaker's blockbuster cancer drug, Keytruda, met the main study goal of helping previously untreated lung cancer patients live longer.

Shares of Leucadia National Corp (>> Leucadia National Corporation) jumped 11.6 percent after the company said it would sell most of its non-financial assets to focus on investment banking and advisory services.

Declining issues outnumbered advancing ones on the NYSE by a 1.10-to-1 ratio; on Nasdaq, a 1.13-to-1 ratio favored advancers.

Volume on U.S. exchanges was 6.28 billion shares, compared to the 7.3 billion average for the full session over the last 20 trading days.

(Additional reporting by Chuck Mikolajczak in New York and Sweta Singh and Diptendu Lahiri in Bengaluru; editing by Nick Zieminski and G Crosse)

By April Joyner