The Brit had dreams of the biggest win of his career when he took the first set, but the Canadian, ranked fourth in the world, came back to claim a 4-6 6-3 6-4 success.
Edmund, who does at least regain his status as British number two from Dan Evans, matched his big-serving opponent in the first set and after making crucial break at 3-3 then served it out to take an impressive lead.
But the match was decided by a run of five successive games for Raonic.
The first three took him from 3-3 in the second set to 6-3, which he then followed up with another break and hold to take an early lead in the decider.
With Raonic's serving prowess, Edmund could not get a look in on his return games, forcing only one deuce, and Raonic advanced to the semi-finals.
Raonic faces a mouth-watering semi-final date with Juan Martin del Potro after the Argentinian continued his comeback from injury with a 7-5 7-5 win over Sam Querrey.
Jack Sock booked an all-American semi-final with Donald Young after progressing past another home favourite Steve Johnson 6-4 7-6 (7/4).
Casper Ruud's dream week at the Rio Open continues as he earned a semi-final meeting with Pablo Carreno Busta.
The young Norwegian had not won a game on the ATP Tour before this week but suddenly finds himself in the last four following a 6-2 7-6 (7/2) success over Thiago Monteiro.
Carreno Busta awaits after the Spaniard beat Alexandr Dolgopolov 7-6 (7/4) 6-7 (7/2) 1-0, with the Ukrainian retiring due to injury.
Dominic Thiem, the second seed, will meet Albert Ramos-Vinolas in the last four after both men beat Argentine opponents.
Thiem breezed past Diego Schwartzman 6-2 6-3 while the Spaniard beat Nicolas Kicker 6-2 6-3.