* TSX up 2.4 points, or 0.02 percent, at 12,542.20
* Up 3.1 percent on the week, volatility high
* Gold shares weaken with bullion (Adds further details)
By Trish Nixon
TORONTO, Aug 12 (Reuters) - Toronto's main stock market index closed slightly higher on Friday, extending its rally to four straight days, as stronger energy shares offset lagging gold-miners.
Canadian equities lagged gains by U.S. stocks. But after sliding on Monday to their lowest level in nearly a year, Canadian shares managed to close the week up more than 3 percent.
"Canada has done really well this week in terms of both absolute performance, and in terms of relative performance compared to the U.S. and indeed to Europe," said Gavin Graham, president at Graham Investment Strategy.
"We were up when the Dow was down 500 points, thanks largely to gold, and that has led to some profit taking."
The energy sector led the gains on Friday, rising 0.27 percent, with oil and gas producers among the most influential gainers.
Baytex Energy Co (BTE.TO) jumped 5.2 percent to $50.24, and Talisman Energy TLM.TO, rose 1.6 percent at C$16.96.
But a hefty drop in gold mining shares kept the broader index in check as gold prices extended losses on Friday, dragging the materials sector down 0.6 percent as a group.
The Toronto Stock Exchange S&P/TSX composite index .GSPTSE closed up 2.4 points, or 0.02 percent, at 12,542.20, with seven of the index's 10 main groups were higher.
The index see-sawed between positive and negative territory through the day, and at one point rose to 12,603.54, the strongest point in over a week.
The market was calmer after a volatile week. Volume of trade was the lowest this month, far below Monday's level which was the highest of the year.
"We're probably through the worst of the equity market event here and would be looking at this from the buyside selectively at this point in time," Paul Taylor, chief investment officer at BMO Harris Investment Management, told reporters in a conference call.
"But there will be some choppiness going forward."
First Quantum Minerals (FM.TO) was the top gainer on the index, jumping 5 percent to C$23.96, after the Canadian miner announced the resignation of its chief financial officer. [ID:nL3E7JC28I]
Valeant Pharmaceuticals (VRX.TO) rose 4.1 percent to C$39.97, leading the healthcare sector up 2.7 percent.
Shares of Azure Dynamics AZD.TO fell 16.3 percent to 18 Canadian cents, a day after the maker of hybrid electric components for vehicles reported a wider quarterly loss and cut its 2011 revenue forecast. [ID:nL3E7JC3D0]
Toromont Industries Ltd, (TIH.TO) a Canadian industrial equipment supplier, posted a seven-fold rise in quarterly profit, helped by higher new machine sales and rental revenue, sending its shares up 4.1 percent to C$17.70. [ID:nL3E7JC3MS]
Celtic Exploration's CLT.TO stock jumped 8.2 percent, after the oil and natural gas company said its second-quarter profit rose despite adverse weather conditions and plant downtime hurting output. [ID:nL3E7JC31W]
$1=$0.99 Canadian Editing by Jeffrey Hodgson