Farid El Alagui volleyed past former Bees goalkeeper Stuart Nelson following Harlee Dean's lay-off in the fifth minute of injury time to maintain Brentford's unbeaten start to the season.
Adebayo Akinfenwa had earlier given the Gills a first-half lead, slotting home from close range in the 40th minute after neat interplay between Myles Weston and Danny Kedwell.
Brentford goalkeeper David Button made two saves in the space of a minute to prevent Weston and Kedwell from doubling the Kent side's advantage shortly after the hour-mark.
The visitors had the majority of the chances throughout the game and could have built a comfortable lead before Akinfenwa's opener had they not have been so wasteful.
Dean's header failed to trouble Nelson after he latched on to George Saville's free-kick in the opening minutes, while Will Grigg should have hit the target after Saville intelligently played him through.
Shaleum Logan headed wide for Uwe Rosler's side late on and Chris Whelpdale's instinctive block denied Clayton Donaldson an injury-time equaliser shortly before El Alagui earned the Bees a point.