U.S. equities traded higher on Friday, with the major indexes on pace for strong weekly gains, as a post-election rally carried on.

The Nasdaq composite outperformed, rising about 0.5 percent to a new all-time high, as the iShares Nasdaq Biotechnology ETF (IBB) advanced 2.3 percent, The S&P 500 gained 0.25 percent, also hitting record levels, with health care leading advancers. The Dow Jones industrial average, meanwhile, joined the S&P and the Nasdaq at all-time highs in midmorning trade, with Apple contributing the most gains.

All the major indexes have been hitting record highs since the election. In fact, the Dow has notched 13 record closes and gains in 19 of the past 23 sessions, entering Friday. The major indexes were also set to post weekly gains of at least 2 percent.

"I'm frankly surprised that we've kept breaking into new highs," said Randy Frederick, vice president of trading and derivatives at Charles Schwab. "The fundamentals aren't terrible, but the valuations have gotten really high. The economic data has been modest, but not great."

"If the market is really being driven by optimism, I can't see that changing until the new administration takes office," said Frederick.

President-elect Donald Trump shocked the world by defeating former Secretary of State Hillary Clinton, who was the heavy favorite to win. Since then, optimism over fiscal stimulus, deregulation of certain sectors and tax cuts has flooded the market.

The small-caps Russell 2000 and the S&P Mid Cap 400 have easily outperformed the Dow, S&P and Nasdaq since Nov. 8, rising 16 percent and 12 percent, respectively.

The U.S. stock market has also managed to brush off a number of potentially detrimental events, including a key referendum in Italy and the European Central Bank's decision to scale back its quantitative easing program, starting in April 2017.

Investors will be bracing for a Federal Reserve meeting set for next week, with the U.S. central bank largely expected to announce tighter monetary policy on Wednesday. According to the CME Group's FedWatch tool, market expectations for a rate hike next week are above 95 percent.

"With yesterday's ECB decision quickly fading from our rearview mirror, next Wednesday's FOMC meeting survives as the lone potential landmine that could give investors pause before boosting their risk," said Jeremy Klein, chief market strategist at FBN Securities, in a note.

"Although the Fed will likely add restrictive measures for only the second time in a decade, the announcement arguably has far less uncertainty surrounding it than usual. Janet Yellen and her colleagues have unambiguously signaled a desire to pull the trigger at its next gathering and will surprise no one by doing so," he said.

In economic news, consumer sentiment for December hit its highest level since January 2015 and wholesale inventories for October showed a decline of 0.4 percent.

"The Trump enthusiasm continues as the UoM consumer confidence index rose to 98 from 93.8 in November," said Peter Boockvar, chief market analyst at The Lindsey Group, in a note. "With the rise in optimism, we'll soon see to what extent this translates into a change in economic behavior."

U.S. Treasurys fell on Friday, with the two-year note yield rising to 1.113 percent, while the benchmark 10-year yield advancing to 2.416 percent. The U.S. dollar rose 0.34 percent against a basket of currencies, building on Thursday's sharp gains following the ECB's announcement.

In oil markets, U.S. crude for January delivery rose 1.44 percent to $51.54 per barrel.