The 34-year-old Brazil midfielder, whose previous deal was due to expire at the end of the season, is now set to stay at the Etihad Stadium until 2021.
Fernandinho has been a City mainstay since his arrival in a £30 million ($39 million, 35 million euros) move from Shakhtar Donetsk in 2013.
“This is the best possible news,” said Fernandinho. “I have enjoyed every second of my time at City.
“I never expected to build such a meaningful relationship with the club and the fans, but it has happened, and I am grateful every single day.”
Although primarily a defensive midfielder, Fernandinho has spent much of this season playing at centre-back because of City’s lack of cover in that area.
Fernandinho has won three Premier League titles and four English League Cups since joining City, but he missed last season’s FA Cup final victory due to injury.