During his time in Manchester, Guardiola has helped City become just the second English men's team to win the Treble - the Premier League, FA Cup and Champions League in the same season.
They have also become the first men's team to win four successive English top-flight titles and to achieve 100 Premier League points in a single campaign.
"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," City chairman Khaldoon Al Mubarak added.
"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."
City are second in this season's Premier League, five points behind leaders Liverpool, and are on a run of four successive defeats across all competitions.
This is the first time Guardiola has endured such a streak of losses - excluding penalty shootouts - in his managerial career.
The Spaniard's new contract comes as City await the outcome of a disciplinary case brought by the Premier League over 115 charges for alleged breaches of league's financial rules, which the club deny but could bring a huge sanction if guilt is established.
Guardiola has continually backed the club and said critics need to wait for the final decision in the case before rushing to condemn.
He is the longest-serving manager in the Premier League, after Jurgen Klopp left Liverpool in the summer.