* TSX ends down 0.6% at 22,851.17

* Tech drops 2.9%, with Celestica down 10.1%

* Materials group loses 1.4% as metal prices fall

* Cogeco Communications jumps after analyst upgrade

July 17 (Reuters) - Canada's main stock index ended its record-setting run on Wednesday as metal mining and technology shares fell, with the latter tracking a sharp selloff in high-flying U.S. microchip names.

The S&P/TSX composite index ended down 144.22 points, or 0.6%, at 22,851.17, snapping a five-session winning streak as well as a streak of four consecutive record closing highs.

"The gravitational pull of pressure on U.S. markets probably spills over to Canada," said Brian Madden, chief investment officer at First Avenue Investment Counsel.

"The most approximate explanation is Democrat and Republican voices talking tougher on China, particularly as it relates to semiconductor chips."

On Wall Street, the S&P 500 and the Nasdaq fell as the prospect of tighter U.S. trade curbs on companies giving China access to advanced semiconductor technology weighed down on major chip and tech stocks.

The Toronto market's technology sector fell 2.9%, with shares of electronics company Celestica tumbling 10.1%, while shares of e-commerce company Shopify Inc ended 6.9% lower.

The materials sector, which includes metal miners and fertilizer companies, lost 1.4% as gold and copper prices fell, while energy was down 0.3% even as oil settled 2.6% higher at $82.85 a barrel.

Cogeco Communications Inc was a bright spot. Shares of the telecommunications company rallied 10.0% after BofA Global Research raised its rating and price objective on the stock. (Reporting by Fergal Smith in Toronto and Nikhil Sharma in Bengaluru; Editing by Shreya Biswas and Diane Craft)