Regardless of the result on Sunday, Federer will reclaim the No. 1 ranking from Rafael Nadal next week.
Raonic, from Thornhill, Ont., won his last title at the 2016 Brisbane International.
The Swiss, who holds 20 Grand Slam singles titles, needed to go all the way against the Austraian Kyrgios, playing his first event in two months due to injury.
The Swiss star has a 10-3 in career head-to-head meetings against the Canadian.More news: Pixar’s ‘Incredibles 2’ Soars To A Record-Breaking $180M Opening Weekend
Raonic gained the upperhand when he was able to steal a point to gain a 3-1 lead in that tiebreak.
The heavy crowd favourite at the Weissenhof Club earned a match point with a high overhead backhand victor and finished off the popular victory seconds later to the roar of fans after just under two hours. Since the beginning of the 2017 season, Raonic has appeared in two finals: May 2017 at the Instanbul Open and the DelRay Beach Open, where he retired, but he had yet to make an appearance in a tournament final this year. "I am so happy to have won", said Federer.
"The most important thing is going to be to focus on my game and if I can do my things well", Raonic said.
Raonic said he is not allowing any thoughts of Queen's club next week or Wimbledon enter his mind.More news: Conway says 'nobody likes' family separation policy
"I'm just concentrating on the job to hand, trying to do it well. It's nice for him, and I hope we can play another great match and I'm really excited to be in the final here".
The seventh-seeded Canadian had 19 aces and saved the only break point he faced. "There is a big difference between playing a semi and a final".
"I hope I can keep up".
The 35th-ranked Raonic, a victim of various injuries over recent seasons, was playing a final for the first time in his last 16 tournaments dating to Istanbul previous year.More news: The iPhone 3GS is going on sale, and no, it isn't 2009
His last grass final came at 2016 Wimbledon in a loss to Andy Murray.
- Meghan Markle just wore a Marks & Spencer fascinator and nobody noticed
- Audi CEO Rupert Stadler arrested in diesel emission case
- Strong deadly quake rattles Japan
- The Queen and Meghan Markle share their first royal visit together
- Phil Mickelson Hits Moving Ball Out of Frustration at U.S. Open
- Saudi-Led Forces Reportedly Seize Airport of Yemen’s Hudaydah
- 3 confirmed dead in Japan earthquake, dozens injured
- Jimmy Kimmel and Sen. Ted Cruz play one-on-one basketball for charity
- VAR Controversy: Was The Referee Right To Award France A Penalty?
- Walmart shooting: Gunman killed by armed civilian in Washington store parking lot