The four-time defending champion has only lost one of his last 21 matches at the O2 Arena and is guaranteed to finish top of the Ivan Lendl group after his 7-6 (8/6) 7-6 (7/5) victory.
It was certainly not straightforward for Djokovic, who again had lapses and had to save a set point in the second set, but victory put the pressure back on Andy Murray in their world number one battle.
The Serbian said: "It was a very close match. I think very few points separated us. It really could have gone either way.
"I was fortunate to get through the first set tie-break. I was down very early in both tie-breaks. But I just managed to stay committed and put pressure on his second serves.
"I should have done my job earlier, to be honest. I'm not very pleased to drop my serve twice against Milos, especially the second time. I was 4-3, 30-0, then just four pretty bad unforced errors.
"But in general, this definitely can serve as a great wind in the back for the next matches to come."
Raonic now faces a straight fight with Dominic Thiem, a 6-3 1-6 6-4 winner over Gael Monfils earlier, for the second semi-final place when they meet on Thursday.
The fourth seed needed to win in straight sets to book his passage through on Tuesday night, which, considering he had won just one set in seven previous meetings, was asking a lot.
At their match in Indian Wells in March, the Canadian managed only two games, but that was against the all-conquering Djokovic.
The question was whether that Djokovic would show up at the O2 Arena or the distinctly less threatening version of the last few months.
The 29-year-old has appeared ill at ease on and off the court, and his victory against Thiem on Sunday was overshadowed by a terse exchange with a journalist in the press conference.
Djokovic insisted he does not feel vulnerable, and Raonic did not detect too many differences in the Serbian's game.
"He's pretty much where he's always been," said Raonic. "Sometimes he slips up one or two points, sometimes he lets it be three points now. I think that's the only difference. Before it would be very rarely you would see two successive poor points from him."
Djokovic, meanwhile, has been relaxing away from the court by spending time with two-year-old son Stefan, and Tuesday morning's activity was a trip to Hyde Park.
The 29-year-old said: "We take a stride. We play with the ducks and swans, ball, playground. It keeps me relaxed. It keeps me grounded, as well. It's very important."
Raonic played surprisingly well against Monfils in his first match for a man who doubted he would be in London after suffering a thigh injury.
His tactic was unsubtle but also effective - serve big and do as much damage with his forehand as possible.
Raonic was generally on top in the first set, forcing break points in Djokovic's opening two service games and keeping his opponent at arm's length with his own mighty serve, which regularly hit 140mph.
But the Canadian could not take his chances and, after fighting back from 3-5 in the tie-break and saving one set point, he double-faulted on the second.
The 25-year-old's hopes were hit further when he twice trailed by a break in the second set but Djokovic, who had seemed to be growing in confidence, inexplicably let his opponent back in.
At 5-6, Djokovic found himself facing set point but a tense exchange ended with Raonic netting a forehand.
The tie-break again could have gone either way but Djokovic dug out a remarkable backhand half-volley at 4-5 and then took his first match point when Raonic pulled a backhand wide.
Earlier, Thiem won the battle of the debutants against an ailing Monfils to post his first victory at the tournament.
Monfils, who double-faulted three times in the final game, arrived at the O2 nursing a rib injury and said afterwards he may not play his third match against Djokovic.
Belgium's David Goffin is first alternate should the Frenchman, who is already eliminated, pull out.