A 5.5pc gain in UnitedHealth Group Inc helped the Dow close above 27,000 points for the first time. Cigna Corp surged 9.2pc.
The abandoned proposal would have required health insurers to pass on billions of dollars in rebates they receive from drugmakers to Medicare patients.
On the flip side, drugmakers such as Merck & Co Inc and Pfizer Inc dropped following the news, and the Nasdaq biotech index was down 1.5pc. Merck ended down 4.5pc while Pfizer was down 2.5pc. The S&P 500 healthcare index ended flat.
The S&P 500 traded above 3,000 for a second day in a row but again failed to close above that milestone, suggesting investor cautiousness.
"The fact that it has not been able to get through it and stay above that level has been a big psychological negative," said Michael James, managing director of equity trading at Wedbush Securities in Los Angeles.
Helping to support stocks were comments from Federal Reserve Chairman Jerome Powell, which supported investor expectations for an interest-rate cut.
In his first day of testimony before Congress on Wednesday, Powell confirmed the US economy was still under threat from disappointing factory activity, tame inflation and a simmering trade war and said the Fed stood ready to "act as appropriate." Powell testified before the Senate Banking Committee on Thursday.
US benchmark bond yields rose, and the S&P 500 financial index gained 0.6pc.
The Dow Jones Industrial Average rose 227.88 points, or 0.85pc, to 27,088.08, the S&P 500 gained 6.84 points, or 0.23pc, to 2,999.91 and the Nasdaq Composite dropped 6.49 points, or 0.08pc, to 8,196.04.
Iron Mountain slumped after Bank of America Merrill Lynch downgraded the document storage company's shares to "underperform," citing recent declines in recycled paper pricing.
A Labor Department report showed US underlying consumer prices rose by the most in nearly 1-1/2 years in June, but that was unlikely to change expectations the Fed would cut rates this month.
Declining issues outnumbered advancing ones on the NYSE by a 1.04-to-1 ratio; on Nasdaq, a 1.25-to-1 ratio favored decliners.
The S&P 500 posted 48 new 52-week highs and 4 new lows; the Nasdaq Composite recorded 77 new highs and 54 new lows.
Volume on US exchanges was 6.17 billion shares.