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

The shower takes place every year, when the Earth moves into the path of debris from the Swift-Tuttle comet.
The shower reached its peak in the early hours of Thursday morning, between 1.00am and 4.00am, when as many as 100 meteors were expected to be seen every hour.
Astronomers expected extra-dark skies which created perfect stargazing conditions.
Have you already caught a glimpse of the shooting stars? Or are you planning on seeing it later?
YOUR COMMENTS:
"I lay outside on our chairs facing the sky. It was very clear as we were in Manchester and we saw about 10 bright, fast meteors. We saw them with the naked eye as they were only visible for around one second!"
Benj, Manchester, England
"I stayed up to watch the meteors. I saw a few.  When I saw one I got very over excited and had to be told to be quiet so I didn't disturb the neighbours."
Alfie, Salisbury, England
"I really enjoyed the meteor shower and I loved all the bright sparks."
Michael, Hereford, England
"I tried to stay up but I fell asleep accidentally! I watched Newsround this morning though and it was so cool."
Francine, London, England
"I normally see it on holiday where there is no light pollution. I live near a busy road so there might be a lot of light pollution."
Sarah, Manchester, England
Thank you for your comments, this chat is now closed.

Cristiano is now just one award behind Barcelona's Lionel Messi, who took the Ballon for the fifth time last year.
Atletico Madrid's Antoine Griezmann finished third.
Ronaldo helped Real Madrid to win the Champions League last season and scored three goals for Portugal who went on to win Euro 2016.
The 31-year-old has won the Ballon d'Or in 2008, 2013, 2014 and 2016.
"I never thought in my mind that I would win the Golden Ball four times. I am pleased. I feel so proud and happy,"  said Ronaldo.
Roger Federer has signed a three-year deal to play at his hometown event in Basel until the age of 38.
[NEXT_CONCEPT]
The Perseid Meteor shower is lighting up the night skies and many kids across the UK are staying up late to enjoy it.
[NEXT_CONCEPT]
Real Madrid forward Cristiano Ronaldo has won the world famous Ballon d'Or footballer award for a fourth time.