Giroud gets his extension barely 24 hours after helping AC Milan reach the semi-finals of the UEFA Champions League for the first time since the 2006/2007 season.
The France international missed a penalty but redeemed himself with the opener as Stefano Pioli's side drew 1-1 with Napoli on Tuesday to complete a 2-1 aggregate victory over the runaway Serie A leaders.
Giroud's previous deal would have expired at the end of this season.
Giroud joined the Rossoneri from Chelsea in the summer of 2021 and has made 76 appearances so far, scoring 27 goals.
The 36-year-old helped AC Milan win the Serie A title in his debut season at the club, scoring 11 goals in 29 games.
A short statement from the San Siro outfit read: "AC Milan is proud to announce that Olivier Giroud has renewed his contract with the Club."
"I'm very proud, very happy - the perfect way to celebrate last night," Giroud told Italian broadcaster Sky Sport shortly after the new deal was announced.
AC Milan are fourth on the Serie A standings and return to domestic action against Lecce this weekend.