Barry, 33, spent last season on loan at Goodison Park from Manchester City and became a key figure for manager Roberto Martinez, making 37 appearances in total, forming a fine partnership with James McCarthy in the heart of the Everton midfield.
The former England midfielder, who cost Everton £2million, had other options but decided to make his stay with the Toffees permanent, with the contract confirmed on the club's website.
He is Martinez's first signing of the summer as the Spaniard looks to bolster his squad with possibly six new arrivals as he prepares for the additional demands of a Europa League campaign.
Barry told evertontv: “I was really keen to get this sorted before the lads come back to training on Thursday. I'm delighted now that everything is signed and that I'm going to be spending the next few years at Everton.
"When you are on loan, it is never the same as being a signed player. I was really settled last year - but now I am an official Everton player and it feels really good.
"From the moment I signed last year I settled in straight away. There is a fantastic history here and it was brilliant working with the manager.
"I have learned so much from him, it is a great set of players and the fans were fantastic last year - just everything about Everton feels right. The training ground, the facilities, the history - there is so much that is positive about the club."
Martinez was delighted to have secured a player he believes has a key role to play in their future.
"We all know the type of footballer that he is and the type of person that he is and he will fit perfectly well into what we are at Everton," he said.
"Gareth is a model professional. He sets high standards in everything he does and that is the perfect model you want for your young players.
"Add to that his experience on the football pitch and knowing how to win big games; he has that winning mentality and it is something I am delighted to bring into the side on a permanent basis.
"It was not just about what he brings with his own performances, which are of the highest level, it is the influence he has with the other players.
"We have got a very talented group of young footballers with big roles in the team already but you need direction and good guidance and leaders - Gareth fits into that group.
"It is an exciting time with us involved in Europe, two domestic cup competitions and the league so we need a player of Gareth's experience and know-how.
"We enjoyed having him as a loan player, but we will be enjoying having him even more knowing he is an Everton player."