Nasri, who has scored 22 goals for the Citizens, said that he is delighted to stay at the club and hopes to give them the best years of his career.
"I'm really happy to have signed this contract and to have committed my future to City," Nasri told the club's official website. "I'm 27 now and if you listen to some of the best managers in the game, they say that a midfield player's best years are between 27 and 30 so I hope that I will give my best years to City.
"It took me time to adjust to living in Manchester because when you move here from London, it is a big change, but last year everything was perfect - I enjoyed my football and I love living in Manchester, feel very settled and I think that showed on the pitch.
"That's why I've agreed this new contract - because I feel very much at home. Our supporters have been right behind me and it gives me the confidence to play my best game."
Nasri's new deal runs out in the summer of 2019.