The Rossoneri are used to challenging for domestic and European honours but this season saw them exit the Champions League in the last 16, while Juventus yesterday claimed the Serie A title with three games remaining.
Sunday's 1-0 win over Torino helped Milan move four points clear of fourth-placed Fiorentina, who suffered a 1-0 defeat at home to Roma 24 hours earlier.
"There are some games in the season that you have to win this way as the result is so important. Credit to everyone, even those who aren't playing that much," Allegri said on the club's official website.
"In the last 26 years, Milan have always been playing at the top end of the table but this year it's been difficult, especially at the start, we dropped a lot of points but the club and team stuck together and worked hard and now the results have improved."
Mario Balotelli was once again Milan's hero as the striker netted the only goal of the game in the 84th minute to give Milan some breathing room in third place.
The Italy international has scored nine goals since swapping Manchester City for Milan in January, helping to ease the burden on Stephen El Shaarawy.
However, chief executive Adriano Galliani instead preferred to focus on the performance of goalkeeper Christian Abbiati, who made a string of excellent saves in the first half to keep the scores level.
"It was a tough game and one that we could have lost. All credit to Abbiati who in my opinion saved our skins," said Galliani.
"He was the best player on the pitch. He'll be here next year for sure.
"He has a lifetime policy here. He's the kind of keeper who saves results as well as shots."