Updated

By Steve Keating

TORONTO (Reuters) - A battling Roger Federer was pushed to the limit but eventually beat lanky Czech Tomas Berdych 6-3 5-7 7-6 in a thriller that lasted nearly three hours Friday to reach to the semi-finals of the Toronto Masters.

Having already beaten Federer twice this season, the towering Czech again appeared to have the Swiss' measure when he powered his way to a 5-2 lead in the third set.

But a relentless Federer refused to fold, finally getting the break he needed with Berdych serving for the match at 5-3.

The quarter-final match marked the third meeting between the two in the past five months, the hard-hitting Czech winning the two previous encounters, including a shock quarter-final upset at Wimbledon.

Federer, twice a champion on the Canadian hardcourts, will next meet the winner of world number two Novak Djokovic of Serbia and Frenchman Jeremy Chardy who play later Friday.

(Editing by Greg Stutchbury)