Milan, who have won only five league games all season, looked to be cruising after Robinho and Mario Balotelli put them two goals ahead after 13 minutes.
Berardi began Sassuolo's fightback in the 15th minute when he rounded Christian Abbiati to score from a narrow angle.
He levelled with a clever half-volley in the 28th minute and completed his hat-trick just before the break when he got between two defenders to fire past Abbiati.
Straight after the re-start, Berardi struck again with a deflected shot to become the first player to score four goals against Milan in Serie A's 85-year history.
“It is an evening I will certainly never forget,” Berardi told Sky Sport Italia while clutching the match ball.
“I am happy for the four goals, but above all because this was an important win for Sassuolo and we really needed that boost.
“I dedicate the goals to our friend Francesco Acerbi, my family, my girlfriend and coach Eusebio Di Francesco.
“It has been a tough time this week with rumours about whether the Coach would leave or not, so this win may well be decisive for his time here. We’re glad to keep him, as he took us into Serie A and has a huge heart, just like the players.”
Acerbi is the Sassuolo defender who is currently undergoing treatment for testicular cancer.
“I think the third goal was most my style. I asked Kaka for his jersey, as my friend wanted it. He’s a great champion and I’m happy to have it even for a little while.
“Tonight I’m going to go off on Italy Under-21 duty.”
Berardi has never played at Under-21 level, as he was suspended in May for failing to turn up to the Under-19 camp.
He had been over-celebrating Sassuolo’s promotion and claimed he did not hear the phone ring or his alarm go off.
- Sports & Recreation
- Christian Abbiati
- Mario Balotelli