Jack Atchison gave the fourth-tier leaders an eighth-minute advantage and were half an hour away from a famous victory until goals from Yoane Wissa, Bryan Mbeumo and Marcus Forss saw the Premier League newcomers through.
Story of the match
Forest Green's first chance came after four minutes when Nick Cadden crossed from the left and Ebrima Adams found space in the penalty area, but he was unable to turn his shot towards goal but warned what was to come.
The visitors went ahead moments later when Brentford failed to clear on the right side. Regan Hendry was denied a shooting chance by Mads Bech, but the ball fell for Aitchison and he smashed an effort past Bees goalkeeper Alvaro Fernandez.
The hosts had all sorts of chances as Halil Dervisoglu turned superbly in the center of the field and passed to Forss, who rounded goalkeeper Lewis Thomas, but was forced to shoot wide.
Thomas then saved from Mads Bidstrup's excellent volley and he then scrambled to his feet to keep out the follow-up shot from Dervişoğlu. He then saved another header from Ethan Pinnock.
That lead should probably only have lasted seconds as Forss released Wissa on the right. He had Dervişoğlu and Saman Ghoddos to pick out but overhit the cross and the ball ran away.
Brentford continued to press for an equalizer and Thomas saved at the feet of Forss after a quick free kick and Ghoddos headed a Dominic Thompson cross wide.
At the other end, Jake Young saw a volley deflect wide for the visitors and Josh March headed a cross from Cadden wide when he got to the ball ahead of Fernández. March had only been on the pitch a matter of minutes after replacing Sadou Diallo, who had suffered an injury to his head after being hit by a clearance and was unable to continue.
Wissa burst from deep after good work by Dervişoğlu, but his low shot was saved by Thomas. Fernández saved from Opi Edwards and Bech, before he was taken off, sliced a shot well wide after a long throw was only half-cleared.
The second half saw the Bees push the tempo as a run from deep from halftime substitute Vitely Janelt allowed Dervişoğlu to attack the edge of the penalty area and after an exchange of passes with Wissa he looked set to shoot but delayed too long and was crowded out.
The visitors nearly grabbed a second when Hendry worked his way in to the penalty area on the left side. His ball flew across the face of goal, just missing the far post and eluding oncoming attackers.
Brentford leveled just past the hour mark. The ball was worked in and out of midfield and after Ghoddos found Wissa on the edge of the penalty area, the Frenchman sent a left-footed shot into the far corner, out of the reach of Thomas.
With the game now turning in their favor, Thompson shot over the bar before Mbeumo tried to release Forss with a through ball, but saw it blocked. He then stepped on to the loose ball, driving through the centre. Left with only Thomas to beat, the striker rolled the ball past him, but just wide of the post.
Frank Onyeka released Canós on the right soon and his low shot was pushed away by Thomas. The Forest Green goalkeeper then saved a volley by Thompson that was set up by Wissa. Forss got to the loose ball, but Thomas again got a hand to it, pushing it down and eventually gathering.
With 15 minutes remaining, the hosts finally went ahead. Thompson got in to space on the left and delivered a cross that was a fraction ahead of Forss, but the arriving Mbeumo headed past a stranded Thomas to make it 2-1.
Taylor Allen shot wide for the visitors, but they were soon reduced to ten men when Abou Adams was sent off after a two-footed lunge on Janelt.
With the man advantage, Brentford put the game out of reach four minutes from time. Canós worked his way down the right and teased his way past Allen into the penalty area. He cut the ball back to Forss, who fired high into the roof of the net despite Thomas getting a hand to it.
Sergi Canos had a shot blocked after more good build-up play by Dervişoğlu and Ghoddos. He then shot well over when a cross dropped in the penalty area.
Onyeka shot wide of the post late on and although Pinnock came off with a knock, the Bees sealed their spot in the third round and will find out their opponent tomorrow.
Man of the match: Yoane Wissa
He showed why Brentford brought him over from Lorient. Marked his first start in a Bees shirt with a wonderful strike to bring them level. Brentford's bright spark on the night and looked lively whenever he was on the ball.