All three of Monaco's goals stemmed from errors by Willy Caballero, Nicolas Otamendi and Stones.
City took a 26th-minute lead through Sterling, found themselves 2-1 and then 3-2 down, but rallied to win thanks to late goals from Sergio Aguero, who scored twice, John Stones and Leroy Sane.
All three of Monaco's goals stemmed from errors -- by Willy Caballero, Nicolas Otamendi and Stones -- and while he was thrilled to see his team prevail, Sterling knew they had been fortunate.
"It's always difficult to go down, but the boys did really well," the England forward told BT Sport at the Etihad Stadium.
"We played our football and stuck to our game and it worked out in the end. At the end of the day, we need to tighten up at the back as well.
"It was good to be a part of. It was end-to-end stuff and Monaco gave us a tough game and pushed us all the way. We got the win and that's the most important thing today."
Sterling's opener was cancelled out by Radamel Falcao, who headed in Fabinho's cross after City goalkeeper Caballero had conceded possession with a loose pass.
Kylian Mbappe put Monaco ahead after Otamendi allowed the 18-year-old striker to run in behind him at a free-kick.
After Aguero had levelled, Stones allowed Falcao to shrug him off the ball in the 61st minute, which freed the Colombian to beat Caballero with a sublime chip.
But Monaco's own defensive deficiencies saw Aguero and Stones score from corners before Aguero teed up Sane for City's fifth goal.