The 53-year-old would have been out of contract on July 1 next year, but has now agreed a new two-year deal.
It comes as Manchester City face being charged with 115 alleged breaches of Premier League rules, which the club denies.
Guardiola took charge of City in 2016 following stints in Germany and Spain.
Since being with the club he has won six Premier League titles, including the last four in succession.
He led City to a league, FA Cup and Champions League treble in 2023, while the club also won the Carabao Cup four years in succession under him between 2018 and 2021.
Guardiola said: “Manchester City means so much to me. This is my ninth season here; we have experienced so many amazing times together. I have a really special feeling for this football club. That is why I am so happy to be staying for another two more seasons.
“Thank you to everyone for continuing to trust and support me – the owner, the chairman Khaldoon (Al Mubarak), Ferran (Soriano), Txiki (Begiristain), the players and of course the fans… everyone connected to Manchester City. It has always been an honour, a pleasure and a privilege to be here.
“I have said this many times before, but I have everything a manager could ever wish for, and I appreciate that so much. Hopefully now we can add more trophies to the ones we have already won. That will be my focus.”
City chairman Khaldoon Al Mubarak added: “Like every City fan, I am delighted that Pep’s journey with Manchester City will continue; allowing his dedication, passion and innovative thinking to continue to shape the landscape of the game.
“His hunger for improvement and success remains insatiable and the direct beneficiaries of that will continue to be our players and coaching staff, the culture of our club, and the English game at large.
“This renewal will take Pep beyond a decade of coaching Manchester City and the opportunity to continue to re-write the managerial record books.”
By Henry Moore