Phil Jevons hit the winner from a fifth minute penalty to give Bristol City their fifth successive league win and push Brentford closer to League Two.
Jevons slotted the ball home from the spot after handball by Kevin O'Connor.
City defender Jamie McCombe hit the post while both he and Lee Johnson were denied by Bees keeper Nathan Abbey.
O'Connor's free-kick was tipped over by Adriano Basso at the other end while Brentford's new loan signing Scott Taylor fired wide in the last minute.
Bristol City: Basso, Orr, McCombe, Fontaine, Brian Wilson, Betsy, Skuse (McAllister 62), Johnson, Noble (Russell 58), Showunmi, Jevons (Smith 80).
Subs Not Used: Thomas, Myrie-Williams.
Goals: Jevons 5 pen.
Brentford: Abbey, Richards, Frampton, Griffiths (Keith 74), Ide, Mousinho, O'Connor, Leary (Heywood 89), Tillen, Shipperley, Taylor.
Subs Not Used: Nelson, Willock, Osborne.
Ref: P Taylor (Hertfordshire).