The 23-year-old had been tipped to follow club and international team-mate Finn Russell out of Scotstoun and was heavily linked with a move south of the border to Bristol.
However, he has now agreed to extend his deal by two years, signing a new contract that will see him remain a Warrior until the summer of 2020.
Gray made his debut as an 18-year-old in December 2012 and has gone on to make 79 appearances for Glasgow, as well as earning 38 caps for his country.
Following the recent speculation, the giant lock, whose older brother Richie plays at Toulouse, says he is pleased with his decision to stay in his hometown.
He told Warriors TV: "This club is very special to me. It's where I'm from, my family and my friends are here and it's a city and a club that I love and I care about a lot. I'm very happy to be here and I'm proud to represent this city.
"With the new coaches coming in it has been a very exciting time. Glasgow are a really ambitious club and have been for a few years and I'm delighted to be a part of it.
"When you run out at Scotstoun you represent more than yourself, you represent your club and your city. The supporters follow us all over and we all want to make them proud.
"There are huge benefits of staying in Scotland and I really appreciate the support from Scottish Rugby in helping me stay with the Warriors for another two years."