By Anna Hirtenstein and Ben Eisen

U.S. stocks edged higher Thursday as investors showed cautious optimism that Congress will reach an agreement on fiscal stimulus measures aimed at parts of the economy.

The S&P 500 rose 0.7% in midday trading, extending the broad-market index's rally into a second day. The Dow industrials climbed 0.3% and the tech-heavy Nasdaq Composite advanced 0.6%.

Applications for jobless benefits last week remained elevated at 840,000, slightly higher than economists' expectations for 825,000, reflecting a slow pace of recovery in the labor market. This metric remains historically high, despite dropping sharply from a peak of near 7 million in March.

"These are still high in the grand scheme of things. They've stabilized over the course of the last few months, but they're also not really going down," said Peter Dixon, an economist at Commerzbank. That will likely put additional pressure on Congress to agree on a package of coronavirus-relief measures, he said.

The S&P 500 climbed Wednesday to its highest close in over a month after President Trump tweeted his support for individual spending packages aimed at small business, airlines and delivering checks to households.

"It's still all about stimulus at this point: We're seeing markets move on optimism that some kind of package is going to get done," said Esty Dwek, head of global market strategy at Natixis Investment Managers. "It's just a question of how much the Republicans will agree to."

Discussions appear to remain ongoing, though Republicans and Democrats remain at odds over crucial details. House Speaker Nancy Pelosi and Treasury Secretary Steven Mnuchin spoke briefly Wednesday about a stand-alone stimulus bill for the airline industry, sending carriers' stocks higher. On Thursday, Mrs. Pelosi signaled she wouldn't support such a bill without a broader coronavirus aid package.

Meanwhile, the market's continued rise has made some investors nervous that speculative buying has pushed stocks to expensive levels, putting them at risk for a reversal even if the economy continues to improve.

"We spend half our time right now telling people how dangerous things are," said Cole Smead, president and portfolio manager at Smead Capital Management, a value-investing firm.

Thursday's rise was led by energy companies. The S&P 500 energy sector was up more than 2%. Oil prices climbed on the prospect of a boost to U.S. growth, with global benchmark Brent crude adding 2.1% to $42.87 a barrel.

Shares of IBM gained roughly 5.9% after it said that it was spinning off its managed-infrastructure-services unit into a new public company as part of a strategy to build up its cloud-computing business.

Regeneron Pharmaceuticals shares rose 2.5% after Mr. Trump said an experimental coronavirus treatment made by the company was key to his recovery. A spokeswoman for the drugmaker on Wednesday said Regeneron has applied to the Food and Drug Administration for emergency-use authorization for its experimental treatment. Shares of Eli Lilly, another drugmaker mentioned by the president in a Wednesday evening video posted on Twitter, climbed 2.1%.

Shares of Eaton Vance surged 48% after Morgan Stanley said it was buying the fund manager for $7 billion. Morgan Stanley, which is pushing further into the money-management business, rose 0.4%, slightly outperforming an index of bank stocks.

Overseas, the pan-continental Stoxx Europe 600 rose 0.8%. In Asia, most major benchmark stock indexes gained. Hong Kong's Hang Seng Index was an exception, slipping 0.2%. That followed reports that the Trump administration is discussing potential curbs to digital-payments platforms developed by Chinese tech companies Tencent Holdings and Ant Group on the grounds of national security. Markets in mainland China remain closed for a holiday.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Ben Eisen at ben.eisen@wsj.com

(END) Dow Jones Newswires

10-08-20 1254ET