Billy Paynter gave Swindon the lead after only 8 minutes with a close range goal.
David Hunt then equalised for Brentford on 33 minutes with a shot from the edge of the box to make it 1-1.
Just before half time Danny Ward then made it 2-1 with a goal from 10 yards out.
On 58 minutes Paynter scored his 28th goal of the season to make it 3-1.
Within 2 minutes Brentford had pulled a goal back to make it 3-2.
Towards the end of the game play was held up for about ten minutes after a bad injury to Pim Balksetein. This lead to the final whistle not blowing until 5.05pm.
As both Leeds and Millwall lost this means Swindon are once again only a a point behind 2nd place with just one game left to play.
Swindon deserved this win, and play well throughout the game. Now if Swindon beat Milwall next week and Leeds don't win then Swindon will get promoted.