Andy Hessenthaler's side deservedly returned to winning ways in a scrappy encounter thanks to second-half goals from Matt Fish and Chris Whelpdale.
Fish opened the scoring with his first goal for the club in the 51st minute and Whelpdale's ninth of the campaign, an 85th minute diving header, sealed the victory.
The Gillingham manager chose to make just one change to the side beaten at Burton in midweek, leading scorer Danny Kedwell
returned at the expense of Reading loanee Jordan Obita.
New Town boss Brian Horton came to MEMS Priestfield with his side winless since New Years Eve, a run of 18 league and cup games but after a reasonable start he saw his team fall away after conceding the first goal.
almost fired the home side into a third minute lead, he moved onto a low Danny Jackman corner from the right but saw his driven effort deflect off Lewis Chalmers and fly back into play off Richard O'Donnell's left-hand post.
There were a number of warnings from the Silkmen, a team of Harlem Globetrotter proportions, as they began to dominate proceedings.
Matt Smith put a downward straight at Paulo Gazzaniga before Arnaud Mendy should have done better than head Matt Hamshaw's corner wide. On loan Oldham Athletic striker Smith had another chance, this time from a Hamshaw free-kick, but again he failed to hit the target with his header.
Both teams continued to battle for possession but it wasn't until the 32nd minute that the Gills next created an opening.
This time it was Whelpdale trying his luck from around 25 yards which O'Donnell had to beat out. In the following play Kedwell played a low ball into the area which Nat Brown got a toe to before Jo Kuffour and then Kedwell fired just wide.
An innocuous challenge from Jackman on Jon Bateson led to a surprise flashpoint as both skipper Andy Frampton
and Ben Futcher unnecessarily went head-to-head and both received yellow cards from referee Danny McDermid.
As half-time approached Kedwell skipped past Tony Diagne in the area only for Brown to block his shot. Whelpdale took the loose ball close to the bye line but his drilled cross was flicked across the face of goal by Jackman.
H/T: 0 - 0
The Gills should have gone in front in the 50th minute, when Kedwell crossed to the far post and Whelpdale nodded the ball down to Kuffour who could only hook the ball into the hands of O'Donnell.
However within a minute Gillingham were ahead. Some neat footwork from Lewis Montrose saw him feed Matt Fish
inside the penalty area and he was able to slip the ball under the surprised keeper. It was the right-back's first goal for the club.
Moments later and the home side were indebted to keeper Gazzaniga for keeping them in front. Hamshaw's corner looked goalbound until the young Argentinjian got his right-hand to it and diverted the ball over the top.
Horton made three substitutions as thye second-half minutes ticked by, introducing first Marcus Marshall then both Michael Bakare and Ross Draper.
The first Gills change came in the 72nd minute when on loan QPR forward Rowan Vine got his first taste of home action when he replaced Kuffour.
Vine almost made an immediate impact, his fierce, swerving strike caused O'Donnell, on loan from Sheffield Wednesday, all sorts of problems but he managed to get something behind the ball and react quickly to recover the loose ball.
Eleven minutes from time Danny Spiller was brought on at the expense of Jackman.
It looked game over when the Gills went 2-0 up in the 85th minute. Kedwell sent Spiller away down the left and his pin-point cross was met by the diving Whelpdale who headed home from inside the six yard box.
Moments later Spiller bundled the ball over the line again after his flick, from Joe Martin
's shot came back off the bar, but unfortunately Matt Foley the refereee's assistant had his flag up.
As the game came to a close Vine twice went close but enough had already been done to earn the much-needed three points and keep the play-off hopes alive.
The Gills remain in ninth place but ended the day just four points behind both Oxford United and Cheltenham Town who occupy the sixth and seventh places in the League Two table.
Gills: Gazzaniga, Fish, Frampton, Essam, Martin, Whelpdale, Montrose, J Payne, Jackman (Spiller 79), Kedwell, Kuffour (Vine 72)
Unused subs: King, Obita, Miller.
Town: O'Donnell, Bateson (Marshall 63), Brown, Chalmers (Draper 67), Mukendi (Bakare 67), Daniel, Mendy, Diagne, Hamshaw, Futcher, Smith.
Unused subs: Veiga, Aley.Attendance
: 4,562 (39 MTFC fans)
: Danny McDermid
: Matthew Buonassisi & Matt Foley
: Michael Bull