The 47-year-old Spaniard led City to the Premier League title with a record 100 points last season.
The contract extension means his deal with City is the longest commitment the former Barcelona and Bayern Munich boss has made to a club since starting his managerial career in 2008.
“I am so happy and excited. It’s a pleasure to work here,” he said.
“I enjoy working with our players every day and we will try to do our best together in the coming years. As a manager, you have to feel good to be with the players – and I feel good.”
Guardiola’s side won the League Cup in 2018, beating Arsenal 3-0 in the final, before claiming the league title by 19 points from rivals Manchester United.
City scored 106 goals and claimed 32 wins, both Premier League records, as they dropped only 14 points in the league all season.
They were beaten by Wigan Athletic in the fifth round of the FA Cup and were knocked out by Liverpool in the quarter-finals of the Champions League.
“I will focus on the desire of my players to become a better team and every day that’s what I will try to do – to improve on the pitch and improve our players,” added Guardiola.
“We have a young squad with an average age of 23 and we want to keep taking steps forward and maintain the levels we’ve achieved this season.” for her much-anticipated appearance at the royal wedding.