In a tight first half of few clear cut chances Luke Rooney drew the first save of the match with a fierce right foot drive that keeper Sullivan pushed over the bar at full stretch.
On 28 minutes Hughes-Mason collected a deep ball in a what appeared to be an offside position, he chipped the oncoming Alan Julian but to his horror the ball bounced wide of an empty net.
Ten minutes later Millwall created a good opening down the right with Price racing on to Hegarty's deep pass before crossing to Janneh, only for the youngster to head tamely into Julian's hands.
Soon after, at the opposite end Rooney's powerful effort was well blocked by Sullivan. While a minute before half time David Martin unleashed the best strike of the half, a ferocious 25 yarder that blistered the paint on the crossbar before drifting behind.
There was still time for Luis Cumbers to fire over from the edge of the box while Julian reacted well to deny a late snap shot from Grabban as the sides remained deadlocked at the break.
HT 0-0
Early in the second half Cumbers ran onto a weak back header by Hegarty but sliced wide with only Sullivan to beat.
Then on 49 minutes Gillingham took the lead, Yussuff sent Miller wide on the right, he cut in a low cross and trialist Gabriel Odunaike slotted in from close range.
Soon after Rooney saw a low shot pushed round the post before the visitors netted their second from the resulting corner. Chris Palmer's in-swinger fell to Adam Miller and the midfielder nodded home from five yards.
On 67 minutes Rashid Yussuff got behind the Lions defence and onto the end of Richards long punt forward but was unable to direct his effort on target pulling a volley into the stands.
Five minutes later Lewis Grabban made a powerful run into the Gills box before letting fly a rasper that flashed passed Julian's left hand upright.
With full time approaching Hughes-Mason went close again as the hosts finished stronly with a curling strike that Julian did well to palm around the post.
Gillingham's third arrived two minutes from time as Millwall commited men forwards, Charlie Stimson controlled Rooney's lob over the defence with a neat touch and placed a finish beyond Sullivan and into the far corner.
Gillingham: Alan Julian, Jack Payne, Garry Richards, Tom Wynter, Chris Palmer, Luke Rooney, Adam Miller, Rashid Yussuff, Josh Sargeant (Andy Pugh 63), Gabriel Odunaike (Tom Murphy 80), Luis Cumbers (Charlie Stimson 82).
Subs not used: Conor Quinn, Dean Rance.
Millwall: John Sullivan, Marcus Bignot, Danny Fitzsimons, Adam Bolder, Omar Beckles, Chris Hegarty, Kiernan Hughes-Mason, Hassan Janneh, Jason Price, Lewis Grabban, David Martin
Subs not used: Phil Stevenson, Wayne Drummond, John Marquis, Grant Ludford, Jake Gallagher.