The Gills finished off their Combination League campaign with another heavy defeat in the pleasant surroundings of Staines Town's Wheatsheaf Park.
Gillingham started on the front foot, Stuart Lewis collecting, Andy Pugh's square ball before flashing a third minute long range effort wide, from just inside the left hand touchline.
That early promise was extinguished two minutes later as the Bees took the lead in the simplest fashion. Essam was penalised for a push, and from the resulting set-piece, Jake Reeves delivered an inviting ball into the area for Mark Phillips to head into the roof of the net.
The visitors had a chance to level in the 12th minute as Alex Brown broke into the box before laying-off to fellow apprentice Tom Brunt but the youngster sliced his finish wide of the near post from 12 yards out.
Gomez sent a shot fizzing over the crossbar on 20 minutes then netted the home side's second five minutes later. Once more Reeves was the provider, Gillingham failed to cut out his free-kick from the right allowing Gomez to volley home, unmarked at the back post.
Reeves could have claimed a goal for himself in the 31st minute but Hawkes dived brilliantly to his right to push his powerful free-kick to safety. There was nothing he could do to prevent the Bees third though, as Ainsworth cut in on the right of goal and pulled back for Gomez to crash in his second at the near post.
Sam Fisher restored some pride for the visitors two minutes from the interval, collecting the ball on the edge of the Bees box before rifling a 25-yard rising drive into the roof of the net. At the opposite end Callum Davies was on hand in time-added-on to block Shaun Lucien as he threatened to score a fourth.
HT: 1-3
Four minutes after the restart Alex Brown found Pugh in space but the striker snatched his effort and finished tamely into the arms of second half sub keeper Simon Moore.
Gillingham lost Alex Brown to injury early in the second half. The midfielder injured his right leg and had to be helped from the field, making way for Rashid Yussuff who had been relegated to the bench, together with James Walker after the pair arrived late for the fixture.
On the hour, the Gills opened up their hosts down the left with a lovely passing move that ended with full-back James Brown crossing low for Andy Pugh. The striker took a touch before shooting on the turn only to be denied by a great stop from Moore, low to his left hand upright.
Three minutes later the home side struck again and once again the danger came from a set piece. Jake Reeves notching his third assist with a near post corner that Chris Bush rose unchallenged to divert into the net.
Then on 65 minutes Brentford claimed a fifth, Ainsworth beating Brown for pace down the right before crossing into the area, Essam headed clear but only as far as Jack Ward who fired low into the net from 15 yards.
James Walker was unlucky with a last minute curling effort to the neat post that Moore reacted well to push behind. Fisher also went close in added time and from the corner following his deflected shot Charlie Stimson grabbed a late consolation for the visitors.
Gillingham: Daran Hawkes, Ryan Benniman, Connor Essam, Callum Davies, James Brown, Sam Fisher, Stuart Lewis, Alex Brown (Rashid Yussuff 55), Tom Brunt, Charlie Stimson, Andy Pugh (James Walker 67).
Brentford: Nikki Bull (Simon Moore 46), Lewis Ferrell, Chris Bush, Jake Reeves, Mark Phillips (James Zanelli 67), Fraser Franks, Lionel Ainsworth, James White, Shaun Lucien, Pelayo Gomez, Jack Ward (Luke Hacker 67).