The victory dented Cheltenham's ambitions of achieving automatic promotion.
The first half was even, with the Robins' Russell Penn missing the best chance when he miskicked from sixteen yards after Jermaine McGlashan had pulled the ball across the box.
Gillingham took the lead right on half time when Oliver Lee played the ball forward, Cheltenham defender Sido Jombati failed to make a simple clearance, and was outmuscled by Jordan Obita, who stabbed the ball beyond the advancing Jack Butland into the bottom corner.
Obita doubled the visitors' advantage eight minutes into the second half, once again profiting from poor defending. Gills keeper Paulo Gazzaniga launched a long punt, Butland and skipper Alan Bennett debated over who should deal with it, and Obita gratefully accepted the chance to lob over the marooned Robins keeper.
Chris Whelpdale put the result beyond doubt with seven minutes remaining when he tapped home Danny Kedwell's low cross from six yards.
Any reproduction, publication or redistribution of this material without the written agreement of 365 Media Group is strictly forbidden.