The 25-year-old's previous contract still had two more years to run, although last week he stated his desire to retire with his boyhood club.
A product of Atletico's youth system, Koke joined their academy as an eight-year-old and made his debut for the first team at 17, coming on against Barcelona at Camp Nou in September 2009.
In total he has played 323 games for Atleti, scoring 28 goals and winning the 2012 Europa League and 2013 Copa del Rey alongside LaLiga in 2013-14, when he was a key performer as Diego Simeone's men stunned Spain's big two.
"It is exceptional news for all Rojiblancos. Koke embodies what it is to be Atletico," said sporting director Jose Luis Perez Caminero.
Gracias TEMPLO!! Por ayudarme a ser la persona que soy hoy y siempre estarás en mi corazón pic.twitter.com/l6O2schw33— Koke Resurrección (@Koke6) May 21, 2017
"He is a very supportive player with the group, who works tirelessly, with a great quality and an enormous capacity for improvement.
"He is one of the leaders of this team and has been raised from a very young age with the values of our academy, so knowing that he will continue with us for many years is the best news.
"Despite his youth, he already has great experience and is an example for all children who are trained in the academy.
"He is a much loved and respected player in the locker room and will make history at the club."
Koke's long-term commitment comes as a timely boost to Atletico after top scorer Antoine Griezmann said he was ready to leave the club and that there was a "six out of 10" chance he would join Manchester United.
Atletico will move to their new Wanda Metropolitano stadium for the 2017-18 season and Griezmann's fellow France forward Alexandre Lacazette has been strongly tipped to join Simeone's men.