The Argentine defender has played 175 times for City and has established himself as the team's regular right-back.
"I have been here for five years and it feels like home. Signing a contract extension with the club makes me feel very happy," he said.
"I feel great here, I like the Premier League, and I think Manchester City are one of the clubs looking for success in the future. It is a club that is very well-organised and when you see that everything works well you want to be here.
"I think we have got a great squad, fantastic players and hopefully we can win something this year,
"I am sure the fans will respond very well as always. They are a big support for the team week in week out, and hopefully at the end of the season the fans and players can celebrate with a trophy.