Niang, 17, had been linked with the likes of Arsenal and Everton this summer after impressing in Ligue 1 for relegated Caen.
But Milan have signed the France youth international on a three-year contract for an undisclosed fee, understood to be in the region of £2 million plus add-ons dependent on a tribunal.
"Stade Malherbe Caen would like to thank M'Baye Niang for what he achieved during the last four years at the club," the French side said on their website.
"The young forward has today signed a three year contract with AC Milan of Serie A. We wish him the best of luck at his new club and in his personal life."
Niang has scored five league goals in two seasons for Caen but is seen as one of the brightest prospects in France.
Milan are also in talks with Roma over a loan deal for Bojan after Barcelona reportedly waived their option to re-sign the Spain striker.