Kompany took over as coach in the 2024/25 season, having previously managed Burnley in the English Premier League.
He led Munich to the German championship in his very first season, and followed it up by winning the Super Cup at the start of the current campaign.
"I am grateful, feel honoured and would like to thank FC Bayern for the trust and the working environment they have offered me from day one," said Kompany. "It feels like I've been here much longer and that I understand the club well.
"It's been a great experience so far. We've started a wonderful journey. Let's keep working hard and celebrate much more!"
The club management praised Kompany's work to date in the highest terms. President Herbert Hainer spoke of a "strong vote of confidence" and emphasised the importance of the extension for continuity and stability.
"Vincent Kompany is held in high regard by the players, the club management and the fans. We are happy about the early extension of our cooperation."
Director of Sport Max Eberl was also delighted: "When we appointed Vinny, we had a clear vision of our shared path and he quickly proved that he can help FC Bayern move forward - both on and off the pitch.
"He is a role model who unites players, fans and everyone at the club, and we want to build something long-term with him."