Costa, who also scored in his side's 1-0 win at the San Siro in the first leg of the last-16 tie, put the Spanish side ahead in the third minute at the Calderon with an acrobatic volley.
Kaka levelled with a header in the 27th before Arda Turan's deflected effort sailed past Christian Abbiati five minutes before half-time to restore the home team's lead.
Raul Garcia headed Atletico's third in the 71st minute before Costa struck again five minutes from time.
"We are grateful for the support of the fans, and the truth is that the team deserves congratulating for the way it has played," Costa said.
"We have done ourselves proud. All teams who reach the quarter-finals are very good. For now we'll just enjoy it."
Atletico, who last reached the quarter-finals in 1997 with a team featuring current coach Diego Simeone, deserved their victory, while Milan's exit means there will be no Italian side in the last eight for the first time since 2009.