Brazilian playmaker Kaka will join former side Sao Paulo on loan before signing for new Major League Soccer club Orlando City in January 2015.
The 32-year-old had his contract with AC Milan terminated by mutual consent, bringing to an end his second spell.
He had one year left on his contract but activated a release clause after Milan failed to qualify for Europe.
"I've always said I wanted to play in the USA and now I have reached an agreement to play there," said Kaka.
The former Brazil international won a Serie A title and the Champions League in his first spell at Milan between 2003 and 2009.
In total, he has scored 104 goals in 307 appearances for the Rossoneri.
Kaka, who was part of the Brazil squad that won the 2002 World Cup and was also named Fifa's World Player of the Year in 2007, returned to the San Siro on a free transfer last summer after four years at Real Madrid.
He missed out on selection for Brazil's 2014 World Cup squad as Milan finished a disappointing eighth last season and failed to qualify for European competition for the first time in 16 years.
Orlando City are set for their first season in the MLS and Kaka would be their first designated player.
"I'm happy to return to Sao Paulo, it's really satisfying for me," added Kaka of the Brazilian top-flight club, where he played from 2001 to 2003.
"Orlando City is a new team with a good project and the owner [Flavio Augusto da Silva] is Brazilian."