The Catalan’s contract was due to expire in the summer after five years at the club – his longest job in management.
But he has moved to end uncertainty over his future by informing City’s hierarchy that he will extend his deal.
City were desperate to keep hold of the former Barcelona manager – but were also prepared to give him time to come to a decision.
That left a question mark hanging over this season that neither the club nor Guardiola wanted to impact their bid to reclaim the Premier League title this term.
There were increasingly confident noises coming out of City that Guardiola would not walk away.
And he has used this international break to come to an agreement in principle to commit his future to the Etihad.
City chairman Khaldoon al Mubarak said: “It is testament to the qualities of the man that Pep Guardiola’s passion and intelligent approach are now woven into the very fabric of the football we play and our culture as Club. That impact has been central to our success during his tenure and it is why I am delighted that he shares our view that there is so much more to be achieved both on and off the field.
“Pep’s contract extension is the natural next step in a journey which has evolved over many years. It is a product of the mutual trust and respect that exists between him and the entire Club. It also goes to the stability and creativity at the heart of our football operations.
“Importantly it is a validation of the football structure and philosophy that has been built over more than a decade and to which he has contributed so much.
“I’m sure all City fans share my delight in this new agreement and in anticipating the exciting opportunities that, with continued hard work, are there to be taken.”
Guardiola added: “Ever since I arrived at Manchester City I have been made to feel so welcome in the Club and in the city itself- from the players, the staff, the supporters, the people of Manchester and the Chairman and Owner. Since then we have achieved a great deal together, scored goals, won games and trophies, and we are all very proud of that success.
“Having that kind of support is the best thing any manager can have. I have everything I could possibly want to do my job well and I am humbled by the confidence the Owner, Chairman, Ferran and Txiki have shown in me to continue for two more years after this season.
“The challenge for us is to continue improving and evolving, and I am very excited and about helping Manchester City do that.”
The first task for Guardiola will be to overcome the challenge of dethroning champions Liverpool.
Guardiola is also desperate to win the Champions League for the first time since leaving Barcelona.
The signing of Lionel Messi could be key to that, with City still monitoring the Argentine’s situation at Camp Nou after their failed attempt to land him last summer.
He is out of contract at the end of the season and a renewed bid could come as early as January, with Eric Garcia used in part exchange.
This weekend get a £10 free bet with Betfair, when you bet £10 on a Same Game Multi on the Premier League.
Terms: Min £10 Same Game Multi bet on any EPL match this Fri – Sun. Free bet valid for 72 hours, awarded at bet settlement. Excludes cashed out bets. T&Cs apply.