The 20-year-old, who joined Milan from Caen three years ago, will now be tied to the Rossoneri until June 2019.
A statement from AC Milan read: “AC Milan announces that M’Baye Niang has extended his contract with the club until June 30, 2019.”
Niang, who has had loan spells at Montpellier and Genoa in the past two seasons, is thrilled to have signed a new deal.
“I’m with the Rossoneri for another two years,” he tweeted. “I am very happy.
“Thanks to Milan for having faith in me, I’m very proud.”
Niang joined Genoa on loan in January and enjoyed some success, scoring five goals in 14 games.