The 21-year-old has been playing in the Glasgow first team since 2012 and made his senior international debut the following year.
Gray regularly partners brother and former Warriors lock Richie in Scotland's second row.
"I'm very happy to be staying at Glasgow," the younger Gray told Glasgow's website.
"It's my home club and I'm just glad I've had the opportunity to sign.
"It's been a a fantastic few years development for me. When I was younger I always had the ambition to play for Glasgow and Scotland and playing in a Rugby World Cup has been a fantastic experience.
"It's great to see [team-mate and fly-half] Finn [Russell] signing as well [for three years] and there is a lot of talent at the club and it's great to be a part of it.
"Everyone works very hard and that just makes you want to improve as a player and improve the team as well. To have the opportunity to work with the coaches and players at the Warriors is fantastic.
"Scotstoun is a fun place to be and everyone works hard for each other and the culture is great.
"I used to go and watch my brother playing at Firhill and it's incredible to see the crowds growing since we moved to Scotstoun. The fans are really passionate and they make it a very special place to play."
Gray has made around 60 appearances for club and country in his professional career and played in four of Scotland's five matches during their World Cup campaign, which ended at the quarter-final stage.
And head coach Gregor Townsend said: "Jonny has made a huge contribution over the last couple of seasons and it's great news that he's staying with us for another three years.
"He works very hard and has made the breakthrough for club and country over the last couple of years."
Scotland lock forward Jonny Gray has signed a new contract with Pro12 champions Glasgow Warriors until 2018.