Atalanta should have taken the lead a few minutes later as a low cross found Daniele Baselli in space, but he shot wide from close range.
© Getty Images
The home side continued to dominate as German Denis missed a header from six yards, before they took the lead in the 21st minute.
Milan went close to equalising shortly after the half-hour mark as Philippe Mexes had a header cleared off the line, but they did not have to wait long as they were awarded a penalty for a foul by Andrea Masiello.
Giampaolo Pazzini buried it into the bottom corner to level the scores, before Bonaventura put the away side ahead by slotting the ball into the back of the net.
The hosts started the second half on the front foot as Denis headed wide from the middle of the box, before Luca Cigarini shot marginally wide.
However, Milan wrapped up the points late on as Bonaventura tapped in his second from close range.