Danny Kedwell's goal early in the second half was enough for the Gills at Priestfield.
Defeats for Rotherham and Northampton ensured a return to the third tier following a three-year absence after Kedwell volleyed home his 15th of the season in the 48th minute.
Northampton went down 1-0 at Bradford, where Nahki Wells took advantage of a mix-up in defence to score easily in the 23rd minute. The win moves Bradford to within two points of the play-offs as Exeter lost 1-0 at home to Dagenham & Redbridge, with Scott Doe's fifth-minute header the only goal.
Rotherham, sixth but with games in hand on those around them, lost 2-1 at Morecambe as Kevin Ellison scored a last-minute winner for the hosts.
Morecambe got the opener against the run of play through Robbie Threlfall, but a somewhat lucky deflected goal from Alex Revell brought Rotherham level, only for Ellison to snatch it at the death.
Cheltenham failed to take advantage of Northampton's defeat and remain fourth after losing 2-0 away to Plymouth, with Michael Hector's own goal ensuring defeat after Reuben Reid's opener.
At the other end of the table, Peter Murphy's injury-time goal for Accrington Stanley kept York in the relegation zone following a 1-1 draw at Bootham Crescent.
York, who sit in the bottom two on goal difference alone, were poised to climb above fellow strugglers Stanley after Adam Reed scored on the stroke of half-time.
Accrington's were about the only fans singing among those near the bottom of the table, with Wimbledon losing 1-0 away to Bristol Rovers and Barnet going down 2-0 at home to Chesterfield.
Fleetwood had a miserable afternoon as they lost 3-0 at home to Rochdale, missing a penalty and finishing with 10 men.
Goals from Ian Henderson and George Donnelly had already put the visitors in control before Andy Mangan missed a 79th-minute spot-kick and Nathan Pond received a second booking two minutes later.
Jason Kennedy's 89th minute goal added insult to injury.
Joel Grant's 19th-minute goal gave Wycombe a 1-0 win away to Oxford.