Watch Serie A LIVE on beIN SPORTS
The Rossoneri severed ties with Giampaolo on Wednesday (AEST) after just seven competitive games in charge, despite a thrilling 2-1 victory over Genoa on Sunday.
Milan confirmed Pioli's appointment in a short statement on its official website.
Former Inter boss Pioli had been out of working since resigning as head coach of Fiorentina in April.
Pioli spent barely six months in charge of Inter, joining in November 2016 and losing his job in May 2017, while he has also had a spell at Lazio.
Luciano Spalletti, sacked by Inter at the end of last term, had been linked, while Gennaro Gattuso was tipped with a swift return and Milan great Andriy Shevchenko was thought to have been under consideration.
Pioli's first aim will be to breathe life into a faltering Milan side, who are 10 points behind leader Juventus after just seven matches and sits 13th in Serie A.
Gattuso led Milan to its highest placing since the 2012-2013 campaign, but a failure to gain UEFA Champions League football and question marks over the team's style of play saw him replaced at the end of last season by Giampaolo, who spent three years at Sampdoria before taking the Milan job.