Depending on appearances will see him tied to the Spanish champions until 2014.
The Mali international, whose existing deal ran out in 2012, will see his deal automatically renewed each year if he plays a certain amount of games.
The buy-out clause in the 30-year-old's new contract has been increased slightly to 100million euros.
Keita, who became the first player from Mali to play for Barca when he moved from Sevilla in 2008, said on his club's website: "I'm very happy to play in Barcelona. I'm playing my third season here and I've won everything, but I want to continue winning more things."
"Here there are many demands and if I can I'm sure that I will retire here. That's my dream, but you need to take it step by step," said Keita.