The English club was rated a 33-1 shot by bookmakers to advance after losing the first leg 4-0 but closed to within one score of the seven-time champions before halftime through Laurent Koscielny, Tomas Rosicky and Robin van Persie.
Both goalkeepers made crucial second-half stops to keep the score 3-0, and Milan tightened up to progress 4-3 over two matches and narrowly avoid another embarrassing turnaround in the Champions League.
"I really don't understand what happened in the first half," Milan defender Philippe Mexes said. "The approach was wrong and hopefully it won't happen again. We played better in the second half, with less fear, and fortunately we managed to qualify."
Milan was on the receiving end of the biggest comeback in Champions League history when it surrendered a 4-1 advantage to Deportivo La Coruna by losing the second leg of a 2004 quarterfinal 4-0. It also suffered the biggest turnaround in a Champions League final by giving up a 3-0 halftime lead over Liverpool.
Liverpool fought back to 3-3 and won the 2005 title in a shootout.
Benfica also advanced Tuesday, beating Zenit St. Petersburg 2-0 to overhaul a 3-2 first-leg deficit and go through 4-3 on aggregate.
Maxi Pereira put Benfica ahead on away goals in first-half injury time and Nelson Oliveira made the game safe in second-half injury time.
Koscielny gave Arsenal hope in the seventh minute, heading in totally unmarked from a corner kick. Milan's shaky defence allowed Rosicky a similar amount of space 19 minutes later, failing to clear the ball to allow the Czech Republic international to pass it into the net from just inside the area.
Alex Oxade-Chamberlain won a 43rd-minute penalty when he sprinted between Djamel Mesbah and Antonio Nocerino, tumbling to the ground in the top corner of the area after clipping Mesbah's heels.
Van Persie dispatched the resulting kick into the top right corner for 3-0 at halftime and almost drew Arsenal level on aggregate in the 59th, putting a rebound shot straight at Christian Abbiati after the goalkeeper had blocked Gervinho's deflected attempt.
Arsenal's hunt for a fourth goal to level the scores began to leave space after halftime, and Zlatan Ibrahimovic shot just wide from long range after intercepting a loose pass from goalkeeper Wojciech Szczesny. Szczesny atoned for his mistake with a point-blank stop with his boot after Nocerino had shot from Alberto Aquilani's pass.
"We have paid the price for a bad first game," Arsenal manager Arsene Wenger said. "But we have given everything. That is all you can do at the top level."
Portuguese side Benfica advanced to the last eight for the first time in six years as Russian champion Zenit tried to cling to its slim advantage and made little impression at Lisbon's Stadium of Light.
Pereira drove in from Axel Witsel's back-heeled pass and substitute Oliveira rounded off a counterattack.
"In the first half we had to clamp them down, and we did," Benfica coach Jorge Jesus said. "In the second half, we had to draw them out to get some space on the break, and we did that too."
Defending champion Barcelona tries to protect a 3-1 lead against visiting Bayer Leverkusen on Wednesday, when Lyon goes to surprise qualifier APOEL.