Leeds needed a better final day result than Burnley to stay up and looked to have taken the lead in the 19th minute when Joe Gelhardt rifled home a smart finish but a VAR check ruled the striker offside.
With Newcastle leading at Turf Moor, the Whites went ahead in the 56th minute after Bees keeper David Raya brought down Raphinha for a penalty that the Brazilian winger stepped up to coolly convert.
News then filtered through that Newcastle had doubled their lead at Turf Moor through Callum Wilson's second goal of the game but Burnley pulled a goal back to make matters rather more nervy at Brentford.
The Bees were then reduced to ten men with 15 minutes left when Kristoffer Ajer went down injured and was forced off when Brentford had already used all three substitutes.
It meant the hosts had to play the last quarter of an hour with a man less but Thomas Frank's side drew level just three minutes later when substitute Sergi Canos sent a brilliant header into the top right corner.
But Canos was booked for his celebration and then picked up a swift second yellow moments later when wiping out Raphinha meaning the hosts were down to nine men for the final ten minutes.
Despite the numerical advantage, Brentford dug deep but with all eyes also on the score at Turf Moor, Jack Harrison made absolutely sure of United's survival when rifling home a terrific finish after a corner was cleared in the 94th minute.
With Burnley beaten 2-1 against Newcastle, Leeds end up finishing three points ahead of the Clarets.
Graham Smyth, the YEP's chief football writer, hands out the scores from a final day epic.