(Reuters) - All three major U.S. stock indexes ended at all-time highs on Monday, extending their record-setting climb of the past few weeks as the dollar’s weakness boosted commodity-related shares.

Deal news also bolstered stocks. Shares of Xylem XYL.N rose 3.9 percent to $50.32 after the water technology company said it would buy Sensus USA for about $1.7 billion in cash.

Oil rose to five-week highs, driving the S&P 500 energy index .SPNY up 0.6 percent, while other commodity-related shares also rose as the U.S. dollar .DXY eased. The S&P 500 materials index .SPLRCM gained 1 percent.

While expectations that the Federal Reserve will continue to keep rates low have helped stoke the market’s rise, some analysts say a better-than-expected earnings picture could propel further gains in stocks.

“We’re moving from an interest-rate-driven bull market to an earnings-driven secular bull market,” said Jeffrey Saut, chief investment strategist at Raymond James Financial in St. Petersburg, Florida. He said earnings should pick up this year and continue to improve “over the next few years.”

The S&P 500’s earnings recession that began in the third quarter of 2015 is on track to end in the fourth quarter. Estimates show profit growth of 8.3 percent for S&P 500 earnings in the fourth quarter, Thomson Reuters data shows.

The Dow Jones industrial average .DJI ended up 59.58 points, or 0.32 percent, at 18,636.05, the S&P 500 .SPX gained 6.1 points, or 0.28 percent, to 2,190.15 and the Nasdaq Composite .IXIC added 29.12 points, or 0.56 percent, to 5,262.02.

Stocks have risen sharply since late June, and the S&P 500 is now up 7.2 percent for the year.

The Fed on Wednesday releases minutes of its July meeting that could provide clues on its plans to raise interest rates and its view on the health of the economy.

Still, traders are largely skeptical of a rate hike in the near term, with U.S. inflation below the Fed’s 2 percent target and as central banks worldwide unleash stimulus programs to support their economies.

The Philadelphia semiconductor index .SOX, up 1.4 percent, touched a 16-year high, while the Nasdaq Biotech Index .NBI was up 0.9 percent.

In other deal news, Post Properties PPS.N gained 9.4 percent to $68.08 after the company agreed to be bought by Mid-America Apartment Communities MAA.N for about $3.88 billion. Mid-America's shares fell 4.9 percent to $97.15.

Twitter TWTR.N rose 6.8 percent to $20.86 after the New York Times reported the company was in talks to bring its app to the Apple TV platform.

Advancing issues outnumbered declining ones on the NYSE by a 1.89-to-1 ratio; on Nasdaq, a 2.24-to-1 ratio favored advancers.

The S&P 500 posted 34 new 52-week highs and no new lows; the Nasdaq Composite recorded 149 new highs and 25 new lows.

About 5.5 billion shares changed hands on U.S. exchanges, compared with the 6.4 billion daily average for the past 20 trading days, according to Thomson Reuters data.