The 27-year-old England international joined Man City from Everton in the summer of 2016 and has won three Premier League titles with Pep Guardiola’s men.
Stones overcame fitness issues to enjoy his best season in a Manchester City shirt last season.
The former Barnsley defender made 35 appearances across all competitions as Man City won the Premier League and Carabao Cup, and made the Champions League final for the first time in their history, losing to Chelsea.
"I couldn't be happier," Stones said after signing his new contract.
"I love being part of this squad. There are so many quality players here and I know we can continue winning trophies, which is my main focus.
"Working with the manager [Pep Guardiola] is a dream - he has taught me so much about the game and I feel like I learn something new every single day.
"The success we've had in the last four years has been incredible. To be a part of it has been a dream come true and I just want to continue winning.
"This is the best place for me to play my football and fulfil my ambitions."
Director of football Txiki Begiristain said: "This is great news for our club. John is an exceptional footballer and a fantastic defender, whose attributes are well suited to our style of play.
"We knew when we signed him that we were getting a talented centre-back, but he has really matured in his five years here and, as we saw last season, is at the top of his game right now.
"John has been an important part of our recent success and we believe he can continue to help us achieve our goals, so for him to commit his best years to us is a major boost for the club."