Kaka, the reigning FIFA Player of the Year, had 10 goals to lead AC Milan to a UEFA Champions League crown last year. Spanish champions Real Madrid and other top clubs tried to lure Kaka away from AC Milan, but the extension will likely keep him in Italy for the rest of his career.
"He is, he is the greatest player in the world, he has decided to tie himself definitively to the Rossoneri colors," said AC Milan Vice President Adriano Galliani on the team's website.
"This is the contract of his life. I hope to be able to do another contract in 2013, but this is proof that Kaka will keep delighting our fans for all of his career."
Kaka, 25, joined AC Milan in 2003. He has eight goals in 20 league games this season and two more goals in seven Champions League matches as Milan tries to defend its title.
He first played for Brazil in 2002 and has made more than 50 appearances while scoring nearly 20 goals.
AC Milan is currently in the Champions League round of 16, tied 0-0 after the first leg with England's Arsenal. The second leg is March 4 in Milan.
AC Milan is currently fifth in Italy's Serie A, two points behind Fiorentina. Milan hosts Lazio on Saturday in league play.