Bayern said the 26-year-old, part of Brazil's 2002 World Cup-winning team, had agreed to sign a three-year contract.
He becomes Bayern's second major signing for next season after Iran striker Vahid Hashemian, who is joining from VfL Bochum.
The four-times
Bayern, who finished second in the Bundesliga behind Werder Bremen to qualify for the Champions League again, might also release Germany midfielder Michael Ballack in whom Barcelona have expressed an interest.