(Updates to market close)

* McCarthy sees path to a debt deal vote by next week - report

* Walmart up as it lifts annual sales, profit view

* Initial claims fall more than expected

NEW YORK, May 18 (Reuters) - U.S. stocks closed higher on Thursday on mounting optimism that a U.S. debt ceiling deal could be reached within days, with discount retailer Walmart Inc providing additional support after an upbeat annual sales forecast.

The benchmark S&P 500 index rebounded from early declines on news that top U.S. congressional Republican Kevin McCarthy said a deal to raise or suspend the debt ceiling could potentially be reached in time to hold a House vote next week.

On Wednesday, President Joe Biden and McCarthy reiterated their aim to strike a deal soon to raise the $31.4 trillion federal debt ceiling and agreed to talk as soon as Sunday.

"Today and yesterday it's really been about some easing pressure form the debt ceiling, McCarthy again came out expressing some optimism a deal could be formed by the end of the week, House could vote on a bill the following week," said Anthony Saglimbene, chief market strategist at Ameriprise Financial in Troy, Michigan.

According to preliminary data, the S&P 500 gained 39.07 points, or 0.94%, to end at 4,197.84 points, while the Nasdaq Composite gained 188.60 points, or 1.51%, to 12,689.44. The Dow Jones Industrial Average rose 117.25 points, or 0.35%, to 33,538.02.

Walmart shares gained after the retail giant reported better-than-expected first-quarter earnings and boosted its 2023 sales and profit outlook.

The debt ceiling has drawn attention away from uncertainty about the Federal Reserve's stance on interest rates.

Economic data showed the number of Americans filing new claims for jobless benefits fell more than expected last week, suggesting the labor market remains tight, giving the Fed more cushion to continue raising rates.

Recent data has indicated some slowing in the U.S. economy following a string of Fed rate hikes to fight high inflation. But while the market is pricing in a rate cut by the end of the year, comments from Fed officials suggested they are not yet ready to cut, or even pause hiking rates, soon.

Dallas Federal Reserve Bank President Lorie Logan and Fed Governor Philip Jefferson said on Thursday the economy does not appear to be softening fast enough for the central bank to pause its rate hike cycle.

"If we get a debt ceiling agreement at the end of the week here and remove that macro issue, you still have the Fed meeting at June, now that is probably a live meeting based on what some of the policymakers have been saying this week, so that could be a concern, it could kind of cap some of the momentum in the market," said Saglimbene.

Despite another rise in the 10-year U.S. Treasury yield, growth stocks advanced, led by a jump in Synopsys shares after its second-quarter earnings results and forecast.

Netflix Inc surged after saying its recently launched ad-supported tier reached nearly 5 million active users per month.

Chipmaker Micron Technology Inc's shares gained as it plans to invest up to 500 billion yen ($3.70 billion) in Japan for new chips over the next few years.

Take-Two Interactive Software Inc jumped as it beat estimates for quarterly adjusted sales.

(Reporting by Chuck Mikolajczak; Editing by Richard Chang)