Despite Raonic's 25 aces, Federer rallied from a set down to defeat the 21-year-old from Thornhill, Ont.
After beating Raonic at Indian Wells in March and Madrid last month, Federer went on to win both titles. The 16-time Grand Slam champion is the favourite to claim a record sixth title at Halle after Rafael Nadal's loss in the quarter-finals to Philipp Kohlschreiber of Germany 6-3, 6-4.
Raonic fired 13 aces in the first set he won on a tiebreak. Federer broke his opponent early in the second, taking the match into the decisive set, which Federer won on a tiebreak to wrap up the match in just under two hours.
The eighth-seeded Kohlschreiber ended Nadal's 13-match winning streak four days after the Spaniard won a record seventh French Open title.
"It's not the time to look for excuses," Nadal said. "He played much better than me."
"Today, from the beginning was tough for me."
Kohlschreiber, the defending champion, fired eight aces in all, ending the first game with his first. He broke Nadal in the next — after the Spaniard saved two break points — and piled the pressure by pulling ahead 3-0.
The German missed the opportunity to break the 11-time Grand Slam champion again in the first game of the second, and defended three break points to hold his serve three games later. Kohlschreiber broke Nadal again in the seventh game and quickly pulled ahead 5-3 lead to win the match in 1 hour and 25 minutes.
"It was a world-class day for me," said the 34th-ranked Kohlschreiber. "In principle I did nothing wrong."
It was his first win over Nadal in nine attempts, although Friday's match was their first meeting on grass.
"It's more a tennis problem than a mental problem," Nadal said. "The transition is difficult. It depends how much time you have. Playing on grass can sometimes be a bit of a lottery."
Kohlschreiber will next meet the winner of the match between third seeded Tomas Berdych of the Czech Republic and wild card Tommy Haas of Germany, playing later Friday.
Earlier, Mikhail Youzhny of Russia beat Radek Stepanek of the Czech Republic 6-4, 4-6, 6-4.Suggest a correction