The Shakers looked set for a third straight defeat after early goals by David Ball and Rotherham captain Lee Frecklington.
Will Vaulks then fired home after 83 minutes to make it 10 points from 12 for the Millers, who are now two points outside the play-off places.
The visitors went in front after five minutes as Tom Aldred cleared Ryan Williams’ cut-back as far as Ball, who curled inside the far post from 12 yards.
Bury replied with Nicky Ajose flashing a low shot across goal but the Millers doubled their lead after 10 minutes.
Anthony Forde’s corner found Frecklington in the centre of the box and the Rotherham midfielder powered a free header inside the far post.
Williams’ low strike was then turned wide by Leo Fasan, while Jay O’Shea and Danny Mayor fired wide as Bury improved slightly after the break.
But centre-half Vaulks fired in a superb strike from the corner of the box as the Millers went four unbeaten for the first time this season.
Chelsea defender Andreas Christensen has revealed that he sought advice from club legend John Terry after making a few costly mistakes recently.
Nemanja Matic believes Manchester United boss Jose Mourinho's driven methods and high expectations will bring the club more success.