Ismael Bennacer put Milan ahead for the second time six minutes from the end before Zlatan Ibrahimovic sealed a hard-fought win against a Bologna team which had Adama Soumaoro and Roberto Soriano both sent off in the first hour.
Stefano Pioli's unbeaten Milan are a point ahead of Napoli, who travel to Roma on Sunday hoping to maintain their 100 per cent record so far this season, but was not be happy with their display.
It comes after a painful Champions League defeat to Porto midweek and with a raft of first-choice players out injured or with Covid-19.
"We thought we had won the game because we were two ahead and had a man extra, but if you stop playing you take a risk," Pioli told Sky Sport Italia.
"It's a big win. We know that when you have European commitments and you play someone who has had all week to prepare it's going to be a difficult match."
Sinisa Mihajlovic's Bologna meanwhile are ninth on 12 points after a defeat which will frustrate their Serb coach after they battled back to level shortly after the break.
"With nine men, 10 men and even with 11 we were better than Milan today, they created little. It wasn't easy but we showed today that we're a good team," said Mihajlovic.
"We lost the points but we've won when it comes to play, spirit, courage and all the things that make a good team."
- Milan save blushes -
Everything seemed to be going Milan's way in the 16th minute when Rafael Leao collected Ibrahimovic's classy through ball and lashed home a shot via a huge deflection off Gary Medel.
Soumaoro was then shown a straight red card for bringing down Rade Krunic as the Bosnian raced through onto Simon Kjaer's pass.
By the time Davide Calabria slotted home the second in the 35th minute Milan looked home and dry, but Bologna came racing out of the traps after the break and were level within seven minutes of the restart.
First Ibrahimovic weakly glanced home Nicolas Dominguez's inswinging corner under little pressure in the 49th minute, and then Musa Barrow slipped behind a stunned Milan defence to confidently finish from Soriano's pass.
Soriano then left his team down to nine with more than half an hour left to play after planting his foot onto Fode Ballo-Toure's ankle as the Senegal international was crossing the ball.
And Bennacer broke the home side's resistance with a stylish first-time finish as the ball dropped to him from high.
Ibrahimovic then gave the scoreline a more flattering appearance when he collected from Bennacer and scored his second league goal of the season.