The match, two minutes shy of four hours, is the longest ever played in Olympic history.
Raonic's usually-forceful serve was off-key in his opening service game as Tsonga broke to-15 before staying strong on his own serve and taking the set 6-3 in just under half an hour.
The second was the same story, however this time it was Tsonga who was broken at the first opportunity and Raonic who held serve to take a 6-3 success and send the match to a deciding third set.
The decider was far more even, with Tsonga the only man offering out break points in the early stages but these were saved as the pair exchanged holds of serve.
As there is no tie-break in the final set at the Games, the pair continued to keep the crowd on Court 1 entertained before the Frenchman broke to claim a famous victory.
Tsonga will battle with either Spain's Feliciano Lopez or Juan Monaco of Argentina for a place in the quarter-finals.