The 51-year-old previously had eight months remaining on a deal set to expire at the end of the current season.
Guardiola has held talks with City executives in Abu Dhabi during the Premier League‘s mid-season break for the World Cup.
The Premier League champions have taken the interruption to the regular schedule as an opportunity to secure Guardiola’s future.
The former Barcelona and Bayern Munich manager joined City in 2016 and has since won four Premier League titles, one FA Cup and four League Cups.
Guardiola is yet to win the Champions League with City, though guided them to their first final in 2021, losing 1-0 to Chelsea.
“I am so pleased to be staying at Manchester City for another two years,” Guardiola said.
“I can’t say thank you enough to everyone at the club for trusting me. I am happy and comfortable, and I have everything I need to do my job as best as possible.
“I know the next chapter of this club will be amazing for the next decade. It happened over the last ten years, and it will happen in the next ten years because this club is so stable.
Guardiola added: “From day one I felt something special being here. I cannot be in a better place.
“I still have the feeling there is more we can achieve together and that is why I want to stay and continue fighting for trophies.”
Khaldoon Al Mubarak, City’s chairman, said: “I am delighted that Pep’s journey with Manchester City Football Club will continue.
“He has already contributed so much to the success and fabric of this organisation, and it’s exciting to think what might be possible given the energy, hunger and ambition that he clearly still has.
“Under his very special leadership our first team has accomplished so much, whilst
continuously playing, and constantly evolving, a City style of football that is admired the world over. Like every City fan, I am looking forward to what lies ahead.”
If Guardiola sees out the entirety of his new deal, he will have spent nine years at City – three times as long as his spell at Bayern.
The Catalan is expected to lead City at a warm weather training camp in Abu Dhabi from 5 December.
City have made a strong start to their Premier League title defence, though sit five points adrift of leaders Arsenal.
The champions suffered a surprise 2-1 home defeat to Brentford in their final game before the break for the World Cup.