The 24-year-old, capped 21 times, has agreed a two-year contract with the Murrayfield outfit.
"It was a very difficult decision to leave a club I've supported since I was a teenager," said Weir.
"It'll be a new challenge for me after six years at the Warriors and when the time comes I'll move on with a number of good memories."
Weir, who featured in two matches at last year's World Cup, made his 100th appearance for the Warriors in the 22-5 win over Racing 92 at Rugby Park on Saturday.
He was a second-half replacement when Glasgow beat Munster in the Pro12 final last May.
"The highlight has obviously been winning the Pro12 last season," he told the Warriors website. "But there is still a lot of rugby to be played this season and my aim is to end my time at Scotstoun on a high."
Weir has scored 55 points in the blue of Scotland, including a final minute drop-goal to secure a 21-20 win over Italy in the 2014 Six Nations and a late penalty in a 21-19 defeat of Argentina in the same year.
"He's had to go through some tough times with injuries but he always brings enthusiasm to training and he's playing some really good rugby," said Glasgow head coach Gregor Townsend.
"It'll be tough for us to go up against him next season, but he wants to fight for the stand-off position at Edinburgh and we wish him all the best when he leaves."
Scotland stand-off Duncan Weir is to join Edinburgh from Glasgow Warriors at the end of the season.