The Nasdaq composite rose 0.1 percent to notch a record close and a five-day winning streak.
The S&P 500 also eked out a record close, with energy rising more than 1 percent to lead advancers. The sector popped after the Energy Information Administration reported a larger-than-expected drawdown in crude barrels.
The Dow Jones industrial average ended about 35 points lower with Disney and Boeing contributing the most losses. The media giant's stock was on track for its biggest one-day decline since June after reporting weaker-than-expected quarterly sales. Boeing, meanwhile, tumbled to session lows after the firm said it is temporarily suspending 737 Max flights.
The reaction to Comey's firing in the market was largely muted because a large number of investors still believe the market will get tax reform at some point.
"The Republicans are a bit nervous but at the end of the day, most of them want to get tax reform through," said Robert Pavlik, chief market strategist at Boston Private Wealth. "But if we get wind that there's not going to be tax reform, ... that's when we get into some trouble."
Chris Zaccarelli, chief investment officer at Cornerstone Financial Partners, echoed Pavlik's remarks. "I don't think this is a make-or-break situation for tax reform," he said. "It would be more market-moving news if this were the final nail in the coffin for tax reform and the market doesn't believe that."
But others were worried that Comey's abrupt dismissal could delay key items in the administration's agenda, including corporate tax reform and deregulation.
"Comey's firing is igniting a storm that will be yet another distraction to the public policy driven thesis for economic growth and higher stocks," Michael Block, chief strategist at Rhino Trading Partners, said in a note to clients Wednesday.
"With that, we are putting our long trade on financials on watch. It worries us that the sector can't hold a rally. The rally in the sector (and for Value vs. Growth) should play out as this situation gets swept away in favor of more talk on tax cuts and stimulus, but any delays will move us to the sidelines and has us choosing spots more carefully," Block said.
Financials, especially banks, have been some of the best-performing stocks since Trump's election last November. The Financials Select Sector SPDR Fund ETF (XLF) has spiked nearly 20 percent since Nov. 8.
Comey's firing came at a time when Republicans were seemingly getting ready to move forward on tax reform as they got the ball rolling on health care reform. On April 26, Treasury Secretary Steven Mnuchin and White House chief economic advisor Gary Cohn outlined Trump's tax plan, which included reducing the top bracket to 35 percent and lowering the business tax rate to 15 percent.
"The market really is expecting a cut," said Matthew Peterson, chief wealth strategist at LPL Financial. "We still feel it's a matter of when, not if a cut happens. But any thought this gets pushed to 2018 is a market negative."
Equities entered Wednesday's session near record highs, as a strong earnings season helped stock prices surge over the past month.
According to data from FactSet, 75 percent of the S&P 500 components that had reported as of Friday had topped bottom-line expectations, while 66 percent had beaten sales estimates. Eighty-three percent of S&P 500 companies had reported as of Friday.
In economic news, mortgage applications rose 2.4 percent on a seasonally adjusted basis last week. Import prices rose 0.5 percent, more than expected.
In Europe, stocks closed mostly higher, with the pan-European Stoxx index rising 0.16 percent. The index is currently outperforming the S&P, but where it goes next depends on what happens in France's parliamentary election next month, said Luke Bartholomew, investment manager at Aberdeen Asset Management.
"It's important insofar as it leads to further European integration," he said.
The Dow Jones industrial average fell 32.67 points, or 0.16 percent, to close at 20,943.11, with Walt Disney leading decliners and Chevron outperforming.
The rose 2.71 points, or 0.11 percent, to end at 2,399.63, with energy leading eight sectors higher and consumer discretionary lagging.
The Nasdaq advanced 8.56 points, or 0.14 percent, to close at 6,129.14.
About nine stocks advanced for every five decliners at the New York Stock Exchange, with an exchange volume of 821.25 million and a composite volume of 3.608 billion at the close.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded near 10.
On tap this week:
1:30 p.m. Minneapolis Fed's Kashkari
2:00 p.m. Federal budget
6:25 a.m. New York Fed President William Dudley
830 a.m. Jobless claims
8:30 a.m. PPI
Earnings: Allianz, ArcelorMittal, JCPenney, Acushnet
8:30 a.m. Retail sales
8:30 a.m. CPI
9:00 a.m. Chicago Fed President Charles Evans
10:00 a.m. Consumer sentiment
10:00 a.m. Business inventories
12:30 p.m. Philadelphia Fed President Patrick Harker