- The Toronto Stock Exchange's S&P/TSX composite index ended up 18.82 points, or 0.12 percent, at 16,221.95, eclipsing Wednesday's all-time closing high.

- Energy shares rose 0.9 percent, with Cenovus Energy Inc gaining 2.1 percent to C$11.58, as oil prices rose.

- U.S. crude futures settled 0.3 percent higher at $59.84 after data showed strong demand for crude imports in China and on increased U.S. refining activity that drew more crude from inventories.

- The largest percentage gainer on the TSX was Canopy Growth Co, which rose 9.5 percent to C$30.41. Gains this week for the shares of marijuana companies come ahead of the legalization of recreational marijuana in California on Jan. 1.

- Open Text Corp, rose 6.9 percent to C$44.66 after S&P Dow Jones Indices announced after the bell on Wednesday that the stock of the business software maker will be added to the S&P/TSX 60, 60 Capped and 60 Equal Weight Indices to replace Agrium Inc.

- Potash Corp of Saskatchewan Inc and Agrium have received final regulatory clearance to merge, forming a new company to be known as Nutrien, the two firms said on Wednesday.

- The materials group, which includes precious and base metals miners and fertilizer companies, dipped 0.3 percent as gold mining shares fell.

- Sandstorm Gold Ltd fell 3.8 percent to C$6.28.

- The industrials group fell 0.9 percent, including losses for railroad stocks.

- One of the biggest drags on the index was Brookfield Infrastructure Partners LP , which fell 2.0 percent to C$56.69 after rallying on Wednesday. Earlier in the week the company announced an agreement to sell its Chilean regulated transmission business for $1.3 billion.

- Six of the TSX's 10 main groups ended higher.

(Reporting by Fergal Smith; Editing by David Gregorio and Diane Craft)

By Fergal Smith