The 35-year-old, who missed the second half of last season with a knee injury, has committed to Swiss Indoors until 2019.
Federer, who returned to action in January, won his first Grand Slam title since 2012 and his 18th in total with victory in the Australian Open.
"Playing in Basel is always a highlight of the year," he said.
He has won Swiss Indoors seven times since making his debut in the tournament in 1998.
He is scheduled to return to action next week at the Dubai Duty Free Championships.
"If I am spared again by the injuries, I am convinced that I am still capable of beating the best players in the world in the big tournaments," he said in January.
Tennis correspondent Russell Fuller
Federer's first appearance in his home tournament was in 1998, where as a 17-year-old he was beaten in straight sets by Andre Agassi.
There is, of course, no guarantee Federer will be on the Order of Play in 2019, but this is another reminder of his long-term thinking.
He missed the last six months of 2016, not just to allow his knee to recover, but also with preservation of his body in mind. At one stage, the conversation revolved around whether Federer would make it to the Rio Olympics. It is time to start the debate about Tokyo.
Media playback is not supported on this device
Roger Federer has signed a three-year deal to play at his hometown event in Basel until the age of 38.