The 16-time Grand Slam champion advanced by beating Gael Monfils of France 6-4, 6-3, 7-6 (3), making it five straight-set wins in a row at Roland Garros.
Against Djokovic, Federer will be up against the player who eliminated him from the semifinals at the last two major tournaments.
"He's been playing fantastic this season, so I know I have to play some of my best tennis," Federer said. "I have a couple of days to prepare for that and come up with a good game plan."
The men's semifinals are scheduled for Friday.
Federer won the French Open in 2009 to complete a career Grand Slam, but he lost in the quarterfinals to Robin Soderling last year. That defeat ended a streak of 23 straight major semifinal appearances for the Swiss star.
He had no such worries this year. Despite losing to Monfils in their previous match -- in the semifinals of last year's Paris Masters -- Federer is now 6-1 against the Frenchman, including two previous wins at the French Open.
"He changes the pace, and he changes the pace so quickly," Monfils said. "That hurts. He's the only one almost to hurt you that much, that quickly."
But things are expected to be a bit trickier in the next round against Djokovic.
The second-seeded Serb, who advanced to the semifinals when quarterfinal opponent Fabio Fognini withdrew Monday because of a left leg injury, is 41-0 in 2011 and has won 43 straight matches dating to last year's Davis Cup final.
"Obviously a big question remains: 'How long can you keep it up?'" Federer said. "I said it a couple weeks ago. It's just hard day in and day out to be asked the questions, 'How many more wins can you get?'
"You would just like to, you know, not talk about it. Just go out there and do it over and over again," he said.
With a victory over Federer, Djokovic can equal John McEnroe's Open era record of 42 straight wins to start a season. And with three more, he would match Guillermo Vilas' record 46-match winning streak.
Murray, lethargic at times and brooding at others, worked his way into the quarterfinals by coming back to beat Troicki in a match that started a day earlier.
The three-time Grand Slam runner-up won the final five games of the fifth set despite injuring his right ankle in the previous round. The first four sets were played Monday before darkness suspended the match.
"The sort of day, day and a half before the match was pretty tough. So it was pretty stressful and tiring before I went on the court," Murray said. "And then, obviously, today more so than yesterday maybe was tougher. I was really nervous."
Murray, who said he had a tear in the tendon in his right ankle, looked out of it in the opening two sets on Court Suzanne Lenglen, often pacing around the clay with his head low and sometimes screaming to no one in particular. But he soon started placing his shots and quickly worked his way back into the match before play was suspended.
When the match resumed Tuesday, the pair held serve until Troicki broke for a 4-2 lead shortly after a ball boy interfered with play on a point won by the 15th-seeded Serb. Troicki complained, but the point was replayed and Murray eventually took a 15-0 lead.
"I won that game, but still, I never saw -- haven't seen it on TV or ever," Troicki said. "I mean, since I watched tennis and I played tennis, I have never seen such a situation. Kid just jumped in and messed up my point."
Two games later, Troicki was serving for the match. He took a 30-0 lead when Murray rallied again and broke back.
"I was a bit nervous and didn't go for my shots at those points, and he took advantage of it," Troicki said. "Definitely one of the toughest losses in my career.
"Not a good moment," he said.
It is the fifth time in the 24-year-old Murray's career that he has come back from two sets down to win. The fourth-seeded Brit is now 11-5 in five-set matches.
Murray will next face Juan Ignacio Chela. The Argentine advanced Monday and will have a day of rest before playing the injured Murray.
"There's a lot sort of liquid and sort of stiffness -- causing stiffness -- and quite a lot of sort of crunching in the joint," said Murray, adding he's been icing his ankle and taking pills. "But the physios and a lot of the guys I work with have really helped. I've got all the best equipment here, all the right advice, and made it as best as possible."
To Troicki, it didn't look as though Murray was feeling the effects of his injury.
"No, not at all," he said. "I mean, to me, he ran normal. We played a couple of times before, so he was running full power and going for his shots. He seemed normal."
According to the International Tennis Federation, it's the first time since 1984 that the top five seeded men all reached the quarterfinals at the French Open and the first time since Wimbledon in 1989 that it happened at any of the Grand Slam tournaments.
Information from The Associated Press was used in this report.