Roger Federer's hopes of knocking Novak Djokovic off the top of the ATP world rankings before the end of the year took a hit Friday when he lost to big-serving Canadian Milos Raonic in the Paris Masters quarterfinals.

The Swiss second seed was beaten 7-6(5) 7-5 and Djokovic later ousted Britain's Andy Murray 7-5 6-2 to advance to the semi-finals of a tournament he won last year.

Federer narrowed the points gap on Djokovic in recent weeks but the loss in Bercy halted his charge.

All is not lost for Federer, however, with Djokovic defending a stack of points at the ATP World Tour Finals in London starting Nov. 9 and the Swede also able to boost his points tally in the Davis Cup final against France.

"Milos played well. As I said, I always thought it was going to get solved in London," Federer, who beat Raonic in the Wimbledon semi-final this year, told a news conference.

"Whether I am No. 1 at the end of this year or one or two weeks later next year, it doesn't really matter. Novak seems to be fit, anyway."

Seventh seed Raonic kept his hopes of qualifying for the season finale in London alive as he served 21 aces to beat Federer for the first time in seven attempts.

Raonic will face Tomas Berdych in the semi-finals after the Czech booked his place in London with a 6-7(4) 6-4 6-4 victory over South African Kevin Anderson.

Djokovic, who edged a close first set against Murray before running through the second, will take on either Japanese sixth seed Kei Nishikori or Spanish fourth seed David Ferrer.

Federer appeared relieved that he would have a little more time to prepare for the Tour Finals.

"What this does is I will have a good preparation for London," he said. "It's not that I didn't want to win here, but I knew it was going to be tough from the start. I accept that."

The 17-time grand slam champion never found the key on Raonic's huge serve and managed to engineer only one break point, in the 10th game of the second set when the Canadian bombed down an ace to fend off a set point.

A superb backhand pass in the next game allowed Raonic to break the Federer serve and he closed out the match in style.

"Considering all the circumstances around it, I think this was the biggest win for me," Raonic told reporters.

Fifth-seeded Berdych, who won on his Bercy debut in 2005, became the sixth player to secure his place in London.

After losing the opening set tiebreak, he found his range on serve to level and recovered from a break down in the third set to finally subdue Anderson and qualify for the year-ender for the fifth year in succession.