Goals in either half from Deon Burton and Jack Payne saw Martin Allen's side pick up three more points despite Adebayo Akinfenwa pulling one back for the hosts late on.
Northampton went close early on through Luke Guttridge before Akinfenwa was denied by a goal-saving block from Tom Flanagan and Kelvin Langmead blazed over from close range.
For Gillingham, who lost their unbeaten start in the league on Saturday, Burton should have done better with his header from Joe Martin's cross and Danny Kedwell was denied by a superb save from Lee Nicholls before Chris Whelpdale turned well and shot just wide from 25 yards out.
Cobblers substitute Chris Hackett almost broke the deadlock when his first-time drive struck the crossbar. But Burton did just that on the stroke of half-time when he latched on a long clearance to round Nicholls and slip the ball into an empty net.
After the restart Charlie Allen broke clear but was clattered by Nicholls when he looked certain to score. Hackett went close to an equaliser when he was denied by a last-gasp block from Adam Barrett.
But Payne doubled Gillingham's advantage in the 55th minute, his first time drive nestling in the bottom corner of the net after the ball ran free on the edge of the box.
Ishmel Demontagnac flashed a shot across goal after bursting into the box but Northampton rarely threatened in the second half.
Akinfenwa finally reduced the arrears in the 82nd minute when he headed home Ben Tozer's long throw-in before Gills substitute Myles Weston saw his cross hit a post late on and Allen was dismissed in stoppage-time after picking up a second yellow card.