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."