Weir joined the Warriors in 2010 and has scored 508 points in 70 appearances for the Scotstoun-based side, with 484 points coming from his boot.
He has helped Glasgow reach the RaboDirect PRO12 play-offs three times in the last four seasons.
Weir, who was born in Rutherglen, started his rugby with Cambuslang at Primary 2 and went through the ranks to play senior rugby for the club.
He has represented Scotland at under-17, under-19 and under-20 level and in 2010 played for Scotland A and Scotland 7s.
Weir made his full Scotland debut against France in the 2012 RBS 6 Nations and has gone on to win 12 caps for his country, scoring 17 points. He has started all four games for Scotland in the RBS 6 Nations this year.
Duncan Weir said: "I'm really happy to have signed this new deal to stay in Glasgow for another two years.
"We have a really strong squad, with a lot of competition for places and it's great to see so many young players coming through."
"It was an easy decision for me to stay. I was born in Glasgow and I'm very proud to be playing for my local club and representing my country."
"Now that this has been agreed I'm looking forward to a successful end to the season, as we try and reach the play-offs once again."
Glasgow Warriors head coach Gregor Townsend said: "We are delighted that Duncan has committed to the club for the next two seasons and this is really good news for us and for Scottish rugby."
"He has made a great return from injury this season and has been a consistent performer for the club and for Scotland during this year's RBS 6 Nations."
"His drop-goal to win the Italy game was top drawer and he has shown that he can operate at the highest level of the game."
"Duncan works hard at getting better every day at training and he's made great strides in both the technical and tactical side of playing at stand-off. His ability to lead the attack is beginning to become a real strength of his game."
"He has a big role to play at the club over the next couple of years."