* TSX ends up 0.66 of a point at 20,297.09

* Materials sector falls 1.4%

* Energy advances nearly 1%

* Industrials gain 0.8%

May 18 (Reuters) - Canada's main stock index rebounded to end slightly higher on Thursday, as optimism that a U.S. debt ceiling deal could be reached soon offset pressure on mining shares as gold prices fell.

The Toronto Stock Exchange's S&P/TSX composite index ended up 0.66 of a point at 20,297.09. It was the second straight day that the index closed higher after it posted on Tuesday its sharpest decline in nearly two months.

Wall Street rallied on hopes that an agreement to raise the U.S. government's borrowing cap could avoid financial instability.

A deal could lead to a "selling opportunity," said Matt Skipp, president of SW8 Asset Management. "Markets will experience a relief rally and that will be the last uptick for a while because we are starting to feel the impact of higher interest rates everywhere."

The Bank of Canada said it was increasingly worried about the ability of households to pay off debts and is seeing signs of financial stress among some home buyers.

The resource and financial shares that dominate the Toronto market have been buffeted in recent months by a pullback in oil prices and stress in the U.S. regional banking sector.

The materials sector fell 1.4% as gold and copper prices declined. But energy advanced nearly 1% and industrials were up 0.8%.

Bausch Health Companies Inc shares climbed 14.6% in a two-day rally, after a favorable patent ruling by a Delaware court.

In contrast, Lightspeed Commerce Inc shares tumbled 12.5% on the company's disappointing quarterly sales forecast.

Shares of luxury winterwear maker Canada Goose Holdings Inc shed 10.2% after the company struck a cautious note on its U.S. business. (Reporting by Fergal Smith in Toronto and by Johann M Cherian and Vansh Agarwal in Bengaluru; Editing by Pooja Desai, Marguerita Choy and Richard Chang)