Milan raced into an early two-goal lead but were behind by the interval and Sassuolo extended their lead further in the second half to lift themselves out of the relegation zone.
Sassuolo pulled a goal back within two minutes as Berardi raced beyond the Milan defence before slotting an effort past the encroaching Christian Abbiati.
Berardi's second of the night came just before the half-hour mark when he saw his initial shot blocked before volleying the rebound low into the net.
Balotelli came close two minutes later when he flashed a shot just past the far post, but it was Berardi's night and he completed his hat-trick in the 41st minute when he converted Alessandro Longhi's cross.
It was more of the same at the start of the second half as the striker got his fourth within two minutes of the restart. This time he was teed up by Jasmin Kurtic before seeing his deflected effort end up in the back of the net.
Milan began to push for a way back into the match and almost found it when Balotelli drove inside from the left before firing an effort just past the post.
They did finally claw a goal back with four minutes of normal time remaining when Riccardo Montolivo drilled a low shot beyond the reach of the keeper and into the bottom corner from 25 yards.
It was almost 4-4 shortly afterwards as Balotelli's header was brilliantly saved by Pegolo before Giampaolo Pazzini powered his header against the crossbar on the rebound.
Despite their late pressure, Milan couldn't find an equaliser as Sassuolo ended a five-match losing streak in dramatic fashion. body check tags ::