Ivan Toney scored twice as Brentford made club history by stretching their unbeaten Championship run to 20 games.
They once again recovered from conceding a sloppy early goal from a set-piece to equalise before half-time through Ivan Toney, and then won it with second half strikes from Vitaly Janelt, Mathias Jensen and Toney’s second, and 22nd of the season.
Middlesbrough’s goal was an own goal from a fumble at a corner by David Raya, who more than redeemed himself with four excellent saves.
The Bees’ previous longest unbeaten league run in a single season was 19 games in 2013/14 – a campaign in which they won promotion from League One.
Brentford got off to a poor start for the second game running, when Raya made a hash of trying to collect a left-wing corner and the ball deflected in off him.
But after Saman Ghoddos twice came close, Toney equalised. Henrik Dalsgaard played a pass from the halfway line which Toney chested into the path of Tarique Fosu, who ran on before pulling the ball across for Toney to slot home – the fourth successive goal that Fosu has created.
Raya kept the scores level either side of half-time by tipping a Britt Assombalonga shot on to the post and then making a double save from Assombalonga again and then a heavy deflection off Janelt.
And the saves were crucial as Brentford turned the game in their favour with two goals in seven minutes. First Toney headed back to the edge of the area to Janelt, who swept the ball home, and then a slip by Paddy McNair on the halfway line allowed Jensen to run through unchallenged, round Marcus Bettinelli and slot the ball home.
Raya then denied ex-Bee George Saville, before Toney headed the fourth. Rico Henry hit the bar and the ball rebounded to Bryan Mbeumo who returned it to Toney to score.
There was still time for Jensen to hit the outside of the post before the Bees could celebrate a victory, which leaves them a point behind leaders Norwich with a game in hand.
Brentford: Raya, Dalsgaard, Henry, Sorensen, Pinnock, Janelt, Jensen, Ghoddos (Reid 83), Canos (Mbeumo 67), Fosu (Zamburek 72), Toney (Forss 83).