The Toronto Stock Exchange's S&P/TSX composite index ended up 216.40 points, or 1.1%, at 20,748.58, its highest closing level since May 4.

It was the sixth straight day of gains for the index. For the week, it climbed 2.7%, its biggest advance since February.

"It's clear to me that the market bottomed last week," said Barry Schwartz, portfolio manager at Baskin Financial Services.

"The headlines may still be lousy for months to come - they may even get worse - but we've definitely had a short-term bottom."

Wall Street also rallied as U.S. data showed signs of peaking inflation and consumer resiliency, sending investors into a long holiday weekend in the United States with growing optimism that the Federal Reserve's policy tightening can avoid tipping the economy into recession.

"There is a sense that there will be a recession in some types of companies but its not pervasive," Schwartz said.

The Toronto market's technology group climbed 2.4%, while heavily-weighed financials ended 1.3% higher as National Bank of Canada closed out a mostly strong quarter for Canadian lenders, reporting second-quarter profit that beat estimates.

Energy was up 1.7% as oil gained 0.9% to $115.14 a barrel on signs of a tightly supplied market.

Sharp declines for the shares of some cannabis producers weighed on the healthcare sector.

Aurora Cannabis fell 38.3% after it upsized its previously announced bought deal financing, and Canopy Growth Corp was down 13.6% after it reported a larger adjusted core loss for the fourth quarter.

(Corrects size of decline for Canopy Growth shares to 13.6% (not 14.6%) in last paragraph)

(Reporting by Fergal Smith; additional reporting by Amal S in Bengaluru; Editing by Alistair Bell)

By Fergal Smith