Despite taking the first set, Bedene went down 6-7 6-3 7-6 against the Canadian who is making his return having been out since withdrawing from the Miami Open in March.
The British number three has been on a roll on his favoured surface, having reached the final in Budapest last week after victories in his previous two Challenger events. But his bid to continue that run in Turkey ended at the second-round stage.
Having lost all 10 previous meetings with top 10 players, Bedene made a solid start against a rusty Raonic, claiming the opening set on a tie-break.
But as Raonic found his range, the big-serving Canadian powered to the second set to level the match before an epic third ensued with Bedene battling back from 4-1 down in the tie-break, only to eventually see Raonic prevail.
Also in Istanbul there were routine victories for second seed Marin Cilic and sixth seed Bernard Tomic who advanced to the quarter-finals.
Tomic, who withdrew in Barcelona last week, followed up a three-set first round win over Mohamed Safwat with a 7-5 6-3 success against Brazil’s Rogerio Dutra Silva and he will now face Raonic in the last eight.
Cilic made the most of his wild card into the event by sinking Damir Dzumhur 6-4 7-5 to advance to a quarter-final showdown with Belgium’s Steve Darcis who was an impressive 6-2 6-1 winner over Czech Republic’s Jiri Vesely.