The Bianconeri parted company with Andrea Pirlo earlier on Friday following a disappointing first season in charge of the club.
Juventus lost their Serie A title to Inter Milan and only secured Champions League qualification on the final day of the season.
Juventus were knocked out of the Champions League at the round of 16 stage by FC Porto but they also won the Italian Super Cup and the Coppa Italia under Pirlo.
Allegri led Juventus between 2014 and 2019, winning five Serie A titles, four Coppa Italia trophies and also reached two Champions League finals.
The 53-year-old had been out of work since departing the Allianz Stadium in 2019 but returns to lead the side for a second time.
A statement on Juve's official website read: "Massimiliano Allegri is the Juventus manager once more.
"Allegri finds a bench that he knows very well, a club that he loves and that loves him back, as today a new journey begins together, towards new goals.
"What he achieved in his first adventure at Juventus are engraved in the club’s history: five Scudetti, four-consecutive doubles, coupled with the Coppa Italia and to the two Super Cups, reaching two Champions League finals in just three seasons, in what were epic feats both in Italy and in Europe.
"We said goodbye two years ago with the message, 'History Alone', the message on the back of the shirt given to Massimiliano Allegri by president Andrea Agnelli with an embrace and a shirt, on which in just two words encapsulated Allegri's experience at Juve.
"The beauty of the story, however, is that it never stops. In football, this means a concept that we have ingrained in our DNA: the best victory is the next one. Always.
"Now we are ready to begin again with Allegri, to build our future together; with his enormous professionalism, his moral strength, with the brilliant ideas of a coach capable of shuffling the cards, both on and off the pitch.
"With his smile, a sort of 'signature'. With his way of understanding football and life with simplicity, with his desire to play things down and with the commitment to enjoy every beautiful moment that being at Juventus can give and will give."