Gallagher was trusted again to start by Thomas Tuchel but he received two yellow cards inside half an hour as the Blues were reduced to then men for the second match in a row.
But Sterling struck twice after the break and although Harvey Barnes halved the deficit, Chelsea did just about enough to hold on and earn a much-needed three points.
Trevoh Chalobah came in to replace the suspended Kalidou Koulibaly for the Blues, who had Tuchel in the stands as he served a touchline ban. James Maddison missed out with injury for Leicester.
The Blues thought they had an early penalty as Ruben Loftus-Cheek went down in the box, but VAR ruled that out as Kai Havertz was offside earlier in the move.
Chelsea made an impressive start but their progress was swiftly halted as Gallagher, already on a yellow card, found himself as the last line of defence as Leicester broke after clearing a corner. He cynically took out Harvey Barnes and the referee wasted no time in producing a second yellow, as the Blues were once again reduced to ten men.
Barnes was harshly denied a goal as his header was ruled out for a foul on Edouard Mendy, before Reece James hammered off the woodwork from a tight angle as the match opened up.
The deadlock was broken less than two minutes after the restart, as Marc Cucurella found Sterling and his deflected strike looped into the back of the net to put the ten men in front. Sterling could easily have had a rapid second, but his effort was brilliantly saved onto the post.
A second did come for Sterling though, just after the hour mark. James whipped a superb ball across the face of goal and his England team-mate could not miss as he had a tap-in at the back post.
That two-goal advantage only lasted a few minutes though, as Leicester got themselves right back in it. Barnes played a nice one-two with Vardy before firing past Mendy at the near post.
The Foxes piled on the pressure as they went in search of an equaliser, as Iheanacho twice went close and Barnes sent another low effort towards the near post but this time it was saved.
Vardy had one strike save and another fired into the side-netting, before Ayoze Perez saw his shot cannon back off the bar as Leicester did everything but score in the closing stages.