Gueye becomes Everton's third signing of the summer following the arrival of strikers Jermaine Beckford and Joao Silva.
Meanwhile, Baines joins Tim Cahill, Jack Rodwell and Seamus Coleman in agreeing to long-term deals with the club this summer.
"I still had two years left so wasn't really thinking about it but the manager [David Moyes] said to me at the end of last season that I had done well and he wanted to reward me with a new contract, which was great," added Baines.
"It is nice to have it sorted before we go away to Australia [pre-season tour] because I can focus on the football and not have anything going on in the background.
"I'm fully-focussed on the trip to Australia and hopefully that will be a good trip leading to a good season."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.