NEW YORK (Reuters) - All three major U.S. stock indexes set record closing highs on Monday, extending their post-election rally as energy and other commodity-related shares gained and Facebook led a jump in technology.

Small caps added to recent gains as well, pushing the Russell 2000 index to a record high close. The session marked the first time all four indexes hit closing records on the same day since Dec. 31, 1999.

Stocks have mostly rallied since the Nov. 8 U.S. election, with investors snapping up shares of banks, health care and other companies expected to benefit from President-elect Donald Trump's policies.

The energy index jumped 2.2 percent, leading gains among major S&P sectors, as U.S. oil prices climbed 3.9 percent. Hopes that OPEC would agree to an output cut next week lifted oil prices. The S&P materials index was up 1.3 percent.

"The post-election rally is continuing," said Bucky Hellwig, senior vice president at BB&T Wealth Management in Birmingham, Alabama. Optimism that Trump will ease regulations and reduce taxes "keeps pulling money into the market," he said.

"A lot of money came out of bond funds last week into stocks, and I think that can continue given the potential spread between what stocks can do versus bonds."

Data from TrimTabs Investment Research showed investors moved $45.7 billion into U.S.-listed equity exchange-traded funds in the eight trading days ended Thursday, the biggest eight-session inflow on record.

The Dow Jones industrial average ended up 88.76 points, or 0.47 percent, at 18,956.69, while the S&P 500 gained 16.28 points, or 0.75 percent, to 2,198.18 and the Nasdaq Composite added 47.35 points, or 0.89 percent, to 5,368.86.

The S&P 500 had last set a closing record on Aug. 15. All three major indexes hit record intraday highs as well.

Expectations may be building that the new administration will bring tax breaks that will help corporations and consumers, said Peter Tuz, president of Chase Investment Counsel in Charlottesville, Virginia. But, he said, "you're betting an awful lot on something that hasn't even been introduced before Congress yet."

After the close, the safe-haven yen rose and U.S.-dollar denominated Nikkei futures hit a session low after reports that a powerful earthquake hit Japan.

During the regular session, the technology index , which had underperformed other sectors following the election, was up 1.1 percent. Facebook (NASDAQ: FB) shot up 4.1 percent, giving the Nasdaq its biggest boost, after the company announced a $6-billion share buyback program late Friday.

Tech deals also boosted sentiment in the sector and the broader market.