The 32-year-old midfielder joined Atletico from Porto in 2008 and during his four seasons at the Vicente Calderon made 139 appearances and helped the Rojiblancos win the 2010 and 2012 UEFA Europa Leagues and the UEFA Super Cup.
The Brazilian, who had a year left on his contract with the Spanish club, left Atletico's pre-season training camp on Friday to finalise his move to
"I'll always remember my time at Atletico. I hope they do very well this season and achieve their objectives."
He added: "I'm really excited about returning to
Real Sociedad continues to hold the edge in the battle for a top-four finish in the Primera Division after a 2-1 victory at Sevilla.