At the same time, surging profits at AI-related companies continue to raise worries.
"Not only are we in an environment where analysts and strategists are forecasting fairly heady growth ... but we're in an environment where the drivers of earnings are becoming a little bit less transparent," said Savita Subramanian, equity and quant strategist at BofA Securities, which has a 7,100 year-end target on the S&P 500.
"These megacap tech companies are now taking on more and more leverage. They're still very healthy from a balance sheet perspective, but they are levering up."
Active hostilities between the U.S. and Iran have subsided, but efforts to reach a peace deal have stalled and passage through the Strait of Hormuz has remained problematic.
The disruption caused oil prices to shoot higher after the start of the U.S.-Iran conflict in late February. Subsequent declines have helped to buoy Wall Street sentiment and reduce worries about inflation.
Investors are looking to Federal Reserve Chairman Kevin Warsh's speech on Friday at the central bank's Jackson Hole symposium for any signals that the Fed may be leaning toward a more hawkish stance on inflation.
Some strategists say U.S. midterm elections, which take place in early November and include federal, state and local contests, will add to near-term uncertainty.
The impact on Congress will be key as U.S. President Donald Trump's Republican party controls both chambers of the legislative body.
"After Labor Day, people will turn their attentions to elections, and they will probably find more reason to sell equities than to buy, so you should see some type of setback," Samana said. But, he added it will likely be followed by a year-end rally that will continue into 2027.