The 30-year-old has been managing an ongoing problem since 2012, which recently became worse and required immediate work by a specialist.
Baines is expected to return to the club for the start of pre-season in July following his rehabilitation.
Manager Roberto Martinez said: “Leighton had a little bit of instability in his ankle and in the last two weeks it flared up, and was really painful in the last game.
“We had to check whether it needed some work. The specialist saw him and it was very quick. He had a straightforward operation yesterday, just to clear the ankle and give it good stability.
“He will be out now until the start of pre-season and we are looking forward to having him back to full fitness.
“It???s what he needs. He???s been trying to play through the pain barrier and it???s been a problem since 2012.”
Baines has made 37 appearances for the Toffees this season, scoring three goals.