Gnabry, 30, has been at Bayern Munich since 2017, following spells at Arsenal, West Brom, and Werder Bremen. His contract was set to expire this summer.
The forward has won six Bundesliga titles in Munich, as well as the Champions League.
After reports he was set to leave, Gnabry has had an impressive season, scoring six goals and providing five assists in 15 league matches.
At Bayern, he has formed a lethal partnership with Harry Kane and wingers Michael Olise and Luis Diaz, creating a formidable attack for the Bundesliga leaders.
Speaking about his future, Gnabry said: “I never thought I would spend a decade at Bayern. The reasons to renew are the team, the coaches, the club, the fans, the city, and the environment. I feel very much at home here.”
So far, he has scored 100 goals in 311 appearances for Bayern across all competitions, adding 69 assists.