The 41-year-old Pirlo won four league titles with Juve as a player as well as being a World Cup winner with Italy in 2006.
He has been coaching the Juventus under-23 squad and has signed a two-year contract to take charge of the senior team.
“Today’s choice is based on the belief that Pirlo has what it takes to lead from his debut on the bench, an expert and talented squad to pursue new successes,” said the club in a statement.
Pirlo played for Juventus between for four years from 2011 before joining New York City in the MLS where he finished his glittering playing career in 2017.
Stepping up to replace Sarri will be his first experience of coaching at the top level and he takes over a side reeling from its last Champions League exit to Lyon.
Cristiano Ronaldo scored a double in the 2-1 home win on Friday, but it could not prevent the Italian powerhouse from going out on the away goals rule after the tie ended 2-2 on aggregate.
Despite leading Juve to a ninth straight Serie A title in his first season in charge, Sarri paid the price for his side’s failure on the European stage.
“Maurizio Sarri has been relieved of his post as coach of the first team,” said a club statement earlier on Saturday.
“The club would like to thank the coach for writing a new page in Juventus history by winning a ninth consecutive Scudetto, the culmination of a personal journey that saw him move through every level of Italian football.”
Sarri, 61, replaced Massimiliano Allegri last season, after leading Chelsea to success in the Europa League.
All looked well as Juventus started the season with a 14-game unbeaten run in Serie A, but was facing a stronger challenge from both Inter Milan and Lazio, losing for the first time in the league to the latter in December.
Defeats in the Italian Cup and Italian Super Cup also undermined confidence in Sarri, while poor form since the season restart saw Juve cling on in the title race by just a single point to Antonio Conte’s Inter.
The exit to Lyon proved the final straw, with Memphis Depay’s first half penalty for the visitor sealing the French side’s passage despite Ronaldo’s goals taking his total to 37 for the 2019/20 season, a club record.
Juventus has not won the Champions League since 1996, finishing runners-up five times in the intervening period with the defeat to Lyon the first in the last 16 since 2016.
It led to a stream of unfavorable headlines in the Italian sports papers as the quest for a third title in Europe’s premier club competition ended in bitter disappointment.
It was a far cry from Sarri’s arrival in Turin last summer, his reputation forged in three seasons in charge of Napoli, where the side’s fast-paced style of football — nicknamed “Sarriball” — earned plaudits as well as turning the team into challengers to Juventus.
Despite winning Europe’s second-tier club competition with Chelsea, Sarri was relieved of his duties after just one season, paving the way for his dream move to Juventus that eventually turned sour.
Pirlo, who also won Champions League honors with AC Milan during his 22-year playing career, will be hoping to emulate that success as a coach in his new job.