Financial companies have led US stock indexes upwards, nudging the Nasdaq composite index to a record high.
The latest gains came as the stock market continued to trade mostly in a narrow range in the absence of major new economic data and ahead of next week's meeting of Federal Reserve policymakers.
Speculation that the Fed will raise interest rates helped boost financial stocks for the second day in a row. Higher interest rates allow banks and credit card issuers to charge more for loans, which boosts profits.
Utilities and consumer goods companies were among the biggest fallers. Energy stocks also fell as crude oil prices declined.
"(Today) is a continuation of fairly muted market action," said Bill Northey, chief investment officer at US Bank Wealth Management. "We've been in a very low volatility period of time. We're also a bit between material economic events."
The Standard & Poor's 500 index gained 0.65 points, or 0.03%, to 2,433.79. The Dow Jones industrial average rose 8.84 points, or 0.04%, to 21,182.53. Both indexes remain slightly below their record highs set last Friday.
The Nasdaq added 24.38 points, or 0.4%, to 6,321.76. Small-company stocks fared better than the rest of the market. The Russell 2000 index climbed 18.94 points, or 1.4%, to 1,415.61.
Bond prices fell while the 10-year Treasury yield rose to 2.19% from 2.18% late on Wednesday.
Stocks wavered between small gains and losses through much of the day as investors tuned in to watch former FBI director James Comey testify before Congress as part of the investigation into Russian meddling in the US presidential election.
In his testimony, Mr Comey's first public statements since his May 9 dismissal, he told Congress that President Donald Trump's administration spread "lies" about him and the FBI after his abrupt firing in May.
Stock indexes barely budged throughout the hearing, the public portion of which ended around midday.
"Today did not turn into a market event, nor did it accelerate the path toward further progress on the legislative and administrative agenda," Mr Northey said.
Investors have been looking for more progress out of the White House on its agenda to cut taxes, increase infrastructure spending and implement other business-friendly policies.
The Republican-led House took steps on Thursday to advance Mr Trump's pledge to ease regulations on businesses by taking a vote on legislation that would undo the stricter banking rules that took effect after the devastating 2008 financial crisis.