The three points send Atalanta a point off the fourth and final Champions League place and stopped Milan from keeping up pace with the top two in the table, leaders Juventus and Inter Milan.
The defeat, just Milan's fourth in the league this season, comes at a bad time before Wednesday's crucial Champions League trip to Newcastle, where Stefano Pioli's side have to win to keep their hopes of reaching the knock-out stages alive.
Muriel's first goal of the campaign came after two efforts from Nigeria forward Ademola Lookman in Bergamo. France attacker Olivier Giroud and Serbia forward Luka Jovic had equalised for the visitors.
Lookman broke the deadlock after 38 minutes despite Milan's control of the game. His low effort was deflected by Fikayo Tomori above Mike Maignan as Lookman claimed his fifth league goal of the season.
It looked like Milan would go into the break trailing, before Giroud levelled matters four minutes into injury time with Milan's eighth attempt at goal.
The veteran France attacker headed in a corner from Alessandro Florenzi, but whistles circled around the ground as the home fans thought Lookman had been fouled by Milan midfielder Yunus Musah in the build-up to the set-piece.
December 9, 2023
Five minutes after the break Maignan stopped 19-year-old Giorgio Scalvini from reclaiming the lead for the hosts by tipping the defender's effort over the bar.
Three minutes later, Lookman went one better than Scalvini with a poacher's finish from Charles De Ketelaere's dangerous cross to make it 2-1. Lookman was denied his hat-trick with quarter of an hour to play as Maignan blocked two of his shots in the space of seconds.
Five minutes later, 19-times league champions Milan were level, quieting the crowd at the Gewiss Stadium, which was lacking a stand behind one goal due to renovation work.
Jovic claimed his second goal in as many games assisted by Christian Pulisic's low cross to set up a tense final 10 minutes in northern Italy.
Muriel, 32, was introduced two minutes later and claimed the winner, as he connected with Aleksey Miranchuk's drilled pass to secure Atalanta's first league win since October 30.
Later, Milan's city rivals Inter can go back above Juve to top spot with a point at home against Udinese. Juve sit in first place after Friday's 1-0 win over champions Napoli. Sunday's highlight is Roma, in fourth, hosting sixth-placed Fiorentina.
December 9, 2023