Frei's international future has been in doubt since last month's Euro 2012 qualifier against Wales, when he a section of the Basel crowd jeered him off the field as he was substituted.
The 31-year-old FC Basel striker then made a gesture which appeared to indicate he had had enough.
"In my decision, I have taken into account the numerous positive wishes, requests and suggestions from people who have encouraged me to carry on in the national team," Frei said in a statement on the Swiss FA's website.
"Equally, the points of view of other people, who have recently made no secret of their opinions that my time in the national team has run out, have been considered and taken seriously."
"This is not a hurried retirement based on emotion, which at best could have left a bitter aftertaste as well as leaving the national team in the lurch," he added.
"This gives everyone a reasonable amount of time, without my blocking the way of younger attacking players to the national team."
Switzerland's last scheduled game this season is their Euro 2012 qualifier away to England on June 4.
"I regret Alex's plans (to quit internationals) because we will be losing one of the most experienced players and one of the most dangerous Swiss strikers of all time," said national team coach Ottmar Hitzfeld.
"On the other hand, I respect his decision. It's something he hasn't taken lightly. And I'm happy that he will be available until the end of the season, including the away matches against Bulgaria and England."
Frei has scored 40 goals in 81 matches for the Swiss since making his debut in 2001, but last hit the target in the World Cup qualifier against Latvia in September last year.
The former Borussia Dortmund striker played at two World Cups and two European Championships with mixed fortunes.
His dreams of leading Switzerland to success as they co-hosted Euro 2008 were shattered when a knee injury forced him to limp out of their opening match with Czech Republic before half-time.
The sight of Frei wiping tears from his captain's armband was the most poignant moment of the tournament.
At Euro 2004, Frei was banned for three games on video evidence for spitting at England's Steven Gerrard and in remorse adopted a llama at Basel zoo - the Andean pack animals spit a foul-smelling substance at aggressors when provoked.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.