Matthew Hill and substitute Leroy Lita struck late on to give Bristol City their eighth successive victory.
City dominated and Lee Miller headed in after three minutes. Marc Goodfellow, Brian Tinnion and Luke Wiltshire missed chances to extend the lead.
Eddie Hutchinson chested Michael Dobson's 77th-minute free-kick to level. But Hill put the home side back in the lead from a goalmouth scramble.
Lita made the points safe with a clinical finish on 89 minutes.
Bristol City: Phillips, Carey, Coles, Hill, Woodman, Goodfellow, Wilkshire, Tinnion, Aaron Brown, Peacock, Miller. Subs: Butler, Burnell, Roberts, Fortune, Lita.
Brentford: Julian, Dobson, Sonko, Kitamirike, Bull, Rougier, Tabb, Hutchinson, Hunt, O'Connor, Wright. Subs: Nelson, Peters, Hughes, Somner, Blackman.
Referee: D Pugh (Merseyside).