A first half Jonathan Douglas goal and a second half Marcello Trotta penalty gave the hosts a 2-0 lead, but Cody McDonald set up a tense finale with a 73rd minute strike.
Douglas broke the deadlock in the 21st minute when he glanced home Jake Bidwell’s left-wing cross from close range.
And Trotta banished his last day Doncaster demons when he coolly slotted home from the spot after Tony Craig was hauled over in the box by Adam Barrett.
The cushion lasted less than three minutes, McDonald latching onto Craig Fagan’s through ball to give Peter Taylor’s side hope.
Alan Judge might have sealed it with minutes remaining when he fired over from the edge of the box after a fluid six-man move.
Bees keeper David Button ensured Brentford made it nine home wins in a row with a superb late save to deny Jack Marriott.