Stevenage moved into the League One play-offs after Brentford struck the woodwork with two penalties.
Jamaal Lascelles felled Clinton Morrison, but Clayton Donaldson struck the bar from the spot for the Bees.
Sam Saunders then rattled the post after Donaldson was fouled by Jon Ashton, before Craig Reid slotted the hosts ahead at the other end.
Luke Freeman rifled in from 25 yards for Boro, before Saunders pulled one back with a fine free-kick late on.
Stevenage are now sixth in the table, two points ahead of Notts County,
who earlier lost to Bury,
with two games to go.
Defeat all but ends any lingering play-off hopes for the Bees, who are now five points behind Stevenage.
VIEWS FROM THE DRESSING ROOM
Brentford manager Uwe Rosler told BBC London 94.9:
"The referee had to do what he had to do, he gave the penalty.
"But he should have shown more bravery, the player should have been sent off.
"It's up to us to score from two penalties so we don't need to look at the referee or to anybody else.
"We should have been up by two, we have to score from two penalties it's as simple as that."
Stevenage 16 Day 03 Laird 05 Ashton 14 Roberts 30 Lascelles Booked 02 Wilson 08 Long (Byrom - 46' ) 24 Bostwick 10 Reid (Mousinho - 65' ) 15 Freeman Booked 29 Agyemang (Beardsley - 77' ) Substitutes 11 Myrie-Williams 13 Byrom 21 Mousinho 20 Beardsley 27 Slew Brentford 31 Moore 14 Logan 22 Osborne (Legge - 77' ) 23 Thompson (Forrester - 63' ) 24 Bidwell Booked 25 Dean 07 Saunders Booked 08 Douglas Booked 20 Diagouraga 09 Donaldson 17 Morrison Substitutes 06 Balkestein 32 Legge 04 Bean 18 McGinn 19 Forrester
Ref: Carl Berry