Raonic, from Thornhill, Ont., was trying to move into the last eight of a Masters 1000 event for only the third time since doing it twice last summer in Toronto and Cincinnati.
But Tsonga, who had his troublesome left knee taped after dropping the opening set of the fourth-round matchup in 37 minutes, was able to maintain his game and eventually take the victory against 17th-seeded Raonic.
It was Tsonga's second win against Raonic after beating him on grass at the London Olympics last summer.
Raonic, who won a third straight San Jose title last month, now stands at 10-4 on the season as he heads to Miami for the Masters tournament there starting in a week.
"I felt I came out playing better than him, but I let that get away from me," said Raonic. "He's a former No. 5 and a Grand Slam finalist. "He knows how to play, he knows how to get out of those situations.
"I had my foot on the pedal and I just let off, it's not a great feeling right now. I had four games in the first set with break chances and I sort of stopped after that and let him get into it.
"He played well and I started making sloppier and sloppier mistakes, a lot of short forehands missed. It hurts because you'll pay for that against these guys."
The 22-year-old Raonic double-faulted on a Tsonga match point after one hour 52 minutes in a match in which he fired a dozen aces but converted on only one of five break chances.
Tsonga held his nerve in the second and third sets, breaking Raonic in the final game of the second after Raonic had saved two set points from Tsonga errors.
The third set stayed tight until Raonic blinked first to take the loss. The match was played on a court at the Tennis Garden without the Hawk-Eye electronic linecalling system, meaning that no challenge could be made from a disappointed Raonic.
"I think it was quite out, the serve. I think we were just confused with what the score was because the screen was off," said Raonic.