The Belgium international will have been at the club for over a decade by the end of his new terms.
|MAN CITY LATEST
Kompany led City to the Premier League title for the second time in 2014 before joining the Belgium squad for the World Cup.
"When I arrived in 2008, I could never have dreamed that we could achieve what we have over the last six years but, for me, this is just the start of the journey," the skipper told his club's official website. "This team is stronger now than it's ever been; we have competition for places in every position and a dressing-room full of exceptional, motivated people who want to continue making history together.
MORE: Coach Ted Lasso returns! | Porter challenges Guardiola | WAGs
"Lifting two Premier League titles, the FA Cup and the Capital One Cup have been four of the best days of my life but I believe that there are many more of these occasions ahead. There are so many new landmarks and records to chase and I hope signing this new contract is taken as a statement of intent that I want to keep fighting for trophies for this special club. We have a common goal and so much to look forward to - a family of clubs, the opening of City Football Academy, exciting players coming through our youth system – why would I go anywhere else?"
Kompany has made 181 Premier League appearances for Manuel Pellegrini's side since joining from Anderlecht.