Wanyama’s announcement comes weeks after he missed out on recent national team duties.
Wanyama, who plays for Major League Soccer side CF Montreal, last appeared for Kenya in November 2020.
He made his international debut in May 2007 and scored seven goals in 64 outings for his country.
The former Celtic, Southampton and Tottenham Hotspur man captained the national side at the Africa Cup of Nations in 2019, when Kenya finished third in their group behind eventual finalists Algeria and Senegal.
Kenya failed to qualify for the upcoming Nations Cup in Cameroon, and parted company with coach Jacob ‘Ghost’ Mulee this month after drawing their first two World Cup qualifiers.
The Harambee Stars are currently second in Group E, two points behind leaders Mali, who have four points, with only the group winners progressing to Africa’s play-offs for the finals in Qatar.