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 .RUT 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 .SPNY 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 .SPLRCM 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.

Traders work on the floor of the New York Stock Exchange (NYSE) in New York City, NY, U.S. November 18, 2016. REUTERS/Brendan McDermid

The Dow Jones industrial average .DJI ended up 88.76 points, or 0.47 percent, at 18,956.69, while the S&P 500 .SPX gained 16.28 points, or 0.75 percent, to 2,198.18 and the Nasdaq Composite .IXIC 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 JPY= rose and U.S.-dollar denominated Nikkei futures NKc1 hit a session low after reports that a powerful earthquake hit Japan.

“Unless we’re missing something here and there’s some significant damage,” markets should calm down, said Stephen Massocca, chief investment officer of Wedbush Equity Management LLC in San Francisco.

During the regular session, the technology index .SPLRCT, which had underperformed other sectors following the election, was up 1.1 percent. Facebook FB.O 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.

LifeLock LOCK.N surged 14.7 percent after Symantec SYMC.O said it would buy the identity theft protection company for $2.3 billion. Symantec rose 3.2 percent. Applied Micro Circuits AMCC.O jumped 11.7 percent after Macom Tech MTSI.O said it would buy its fellow chipmaker for $770 million. Macom was off 4.1 percent.

Among the bigger decliners, Tyson Foods TSN.N shares fell 14.5 percent after the meat processor forecast a lower-than-expected 2017 profit and said its CEO would step down.

About 6.7 billion shares changed hands on U.S. exchanges, below the 8.1 billion daily average for the past 20 trading days, according to Thomson Reuters data.

NYSE advancing issues outnumbered decliners 2.99-to-1; on Nasdaq, a 1.45-to-1 ratio favored advancers.

The S&P 500 posted 42 new 52-week highs and 3 new lows; the Nasdaq Composite recorded 249 new highs and 24 new lows.