Djokovic, the newly crowned world number one, claimed his 50th win of the season, beating Croatian Marin Cilic 7-5, 6-2, as he closed in on his ninth title for 2011.
Federer lost to Tsonga for the second time this summer, going down 7-6 (7/3), 4-6, 6-1.
"I really played good tonight," Tsonga said. "I was opportunistic. I didn't miss any opportunities I had. I was able to break before he did and I'm very happy the way I won this match.
"I'm happy now to be in the quarterfinals. It was a tough draw to have Federer in the round of 16."
The contest came just weeks after the burly Frenchman beat the Swiss master in the Wimbledon quarter-finals, when he staged an incredible comeback from two sets down.
Federer remained positive despite the loss.
"I played two matches, I feel good physically," he said.
"New York is in one month -- it's far away. For the time being, the focus is here, not elsewhere. But if you want to talk about the US Open, I can tell you I feel good mentally and I'm playing well."
Federer now travels to the Cincinnati Masters, his last event before the US Open, which begins on August 29.
The 30-year-old's only title this season came in Doha in early January.
"He's playing well. I thought if he was going to play well again, and me not at my best, he could do it again," Federer said of Tsonga.
"It's not like he's beating me the first time.
"He played an excellent third set. The first two sets were tighter. I should maybe have won the first one, I had some opportunities.
"In the second I was able to hold my serve. I might have won, but he was able to finish off the match very well."
The win gives Tsonga a 3-4 head-to-head record against the 16-time grand slam champion.
Compatriot Gael Monfils, seeded fifth, joined him in the last eight, saving three match points in a 3-6, 7-6 (7/0), 7-6 (7/5) win over Serb Viktor Troicki.
But Spain's Nicolas Almagro prevented a Gallic hat-trick as he recovered from 2-5 down in the opening set to overhaul tenth seed Richard Gasquet 7-6 (7/5), 6-3.
Djokovic's only loss in 2011 came at the hands of Federer in the Roland Garros semi-finals.
The Serb advanced comfortably on Thursday despite challenging conditions.
"It was quite a bit different than yesterday, there was a lot of wind involved," Djokovic said.
"It wasn't really a beautiful match to play and to watch.
"In the right moments I was trying to keep the ball into the court, make my opponent make an unforced error. I was just more patient and played well -- that's the positive."
Djokovic admitted he was surprised by the second-round exits of both second seed and two-time winner Andy Murray.
"It's expected from them and from all of us top players to advance, you know, to the last stages of a tournament. But it happens.
"This is tennis. Both of their opponents have played great matches, and that's it. You move on. You have to forget about what you've done, there is already next week another tournament."
Djokovic earned the opening set on a late break and took a 3-1 lead in the second to pave the way to his 50th season win.
Czech seventh seed Tomas Berdych defeated huge Croatian server Ivo Karlovic 6-3, 7-6 (7/2) and next faces Serb Janko Tipsarevic.
Tipsarevic knocked out Croatian Ivan Dodig, a surprise winner in three sets over Nadal on Wednesday, 6-1, 6-4.
Stanislas Wawrinka nullified the huge serve of Kevin Anderson, limiting the South African to six aces in a 6-4, 4-6, 6-4 win.