Financial stocks led the way, as the momentum in Washington for an overhaul of bank regulations held up in advance of a preliminary vote on Thursday.
The Dow Jones climbed 37.46 points or 0.18% to 21,173.69. The wider S&P 500 added 2.81 points, rising 0.16% to 2,433.09.
The Nasdaq closed up 0.34% at 6,296.70.
Trade volume lessened, as investors trod with caution ahead of the UK general election and former FBI director James Comey's testimony in Washington on Thursday.
Some of the impact of that testimony was blunted by the release of his prepared remarks, which repeated already available information.
Energy stocks fared the worst on Wednesday, as oil prices slid following a new report that showed a rise in US production.
Financial firms were among the biggest risers.
The US House of Representatives is expected to approve a bill on Thursday that would undo many of the financial rules put in place after the 2008 crisis.
Few expect the proposal in its current form to advance from the House into law, but they say its support is a sign that a more limited reform could succeed.
The Federal Reserve also said three major banks, including Deutsche Bank and UBS Group, would be given more time to comply with one of those financial rules.
Bank of America shares closed the day up 1.66%, JP Morgan Chase gained 1.15%, Deutsche added 0.75% and Goldman Sachs rose 0.58%.
Shares on Wall Street closed higher on Wednesday, recovering ground after a fall on Tuesday.