Milan's hardcore supporters, known as Ultras, were among those who had wanted the phlegmatic coach to keep his job after leading a young and rebuilt Milan team to third place in Serie A this season.
"The relationship with the coach, which has never been interrupted, continues with confidence and in absolute and mutual respect," Berlusconi said in a statement on Milan's website.
His decision followed a meeting with Allegri and chief executive Adriano Galliani.
"We had a cordial and frank discussion with Galliani and Allegri in which we looked over and analysed last season and clarified a few things," said former Italy Prime Minister Berlusconi.
"We reached an agreement over the rights and obligations of the club to the coach and of the coach to the club. We also talked about the type of game that Milan will have to play next season and drew up the guidelines for the transfer market."
Allegri joined Milan for the 2010/11 season, leading them to the Serie A title at the first attempt.
They finished second the following season and third this time around, although this was regarded as a respectable result after a number of top players were sold to cut the wage bill.
Allegri has been widely praised for the way he has rebuilt the side with young players and handled temperamental figures such as maverick striker Mario Balotelli, signed from Manchester City in June, and Robinho.
Ten days ago, Milan's Curva Sud supporters group issued a statement praising Allegri and criticising the idea of replacing him.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.