In-form striker Cody McDonald scored two first-half goals to set Gillingham on their way to a 3-1 victory over promotion-rivals Rotherham .
The on-loan Norwich hitman took his season tally 17 with a goal either side of Nicky Law's seventh-minute stunner.
And the Gills, who are now unbeaten in four, secured the points a minute from time when substitute Dennis Oli broke his duck for the campaign.
The home side took the lead in the fifth minute, McDonald bundling home his 16th of the season after being released by Adebayo Akinfenwa.
Rotherham hit back immediately when Law curled home a wonderful 20-yard free-kick for his third goal of the season.
The Gills continued to dominate and deservedly had the lead again in the 36th minute when McDonald fired home expertly with his left foot from a tight angle. And, with a minute remaining, Oli smashed in off the post as Rotherham slipped to their fourth away defeat on the trot and out of the automatic promotion places.