The goalkeeper saved Grady Diangana’s penalty in the shoot-out as the visitors progressed 5-4 after drawing 2-2 at The Hawthorns.
Baggies skipper Hal Robson-Kanu struck twice from the spot in the second half either side of a brilliant overhead kick from Emiliano Marcondes.
Marcus Forss – a former Baggies trainee – then scored his own penalty to force a shoot out.
Marcondes hit the post for the visitors in the first half and Conor Gallagher twice went close before the penalty drama.
The Bees booked a fourth round home tie against either Fulham or Sheffield Wednesday next week.
Gallagher should have given Albion the perfect start just two minutes into his debut.
Matt Phillips found space down the right and crossed for the Chelsea loanee to blaze over from 10 yards.
It was a glorious early opening and the scare allowed Brentford to regroup and Tarique Fosu-Henry’s ball flashed across the six yard box before Rico Henry drove wide.
Thomas Frank’s side, last season’s beaten Sky Bet Championship play-off finalists, finished two points behind the Baggies in the race for promotion but were the slicker side.
Albion lacked bite but survived when the Bees almost broke the deadlock after 21 minutes.
Marcondes had been busy, often dropping deep, but the striker went close when he collected the ball and fired against the inside of the post from 18-yards.
It bounced out to Fosu-Henry, who had an open goal, but he opted to take a touch which allowed Lee Peltier to block his shot.
Brentford remained on top without seriously threatening and, after a forgettable spell, were made to pay 11 minutes into the second half.
Robson-Kanu stole in after the Bees dithered and Dominic Thompson’s desparate challenge brought him down inside the box.
The Albion skipper rolled the ball in from the spot but the Bees hit back in stunning style two minutes later.
A deep delivery found Charlie Goode to head back for Marcondes who produced a brilliant overhead kick from 10 yards which went in off the bar.
Yet the Bees fell behind again after 66 minutes when Goode rashly barged over Kyle Edwards and Robson-Kanu netted his second from 12 yards.
Just seven minutes later, though, they were level again when Cedric Kipre was adjudged to have brought down Forss in the box.
It was a soft decision by referee Darren England but Forss blasted in to level the tie.
Fosu-Henry fired just wide and Raya turned Gallagher’s strike away before the shoot-out.
Raya proved the difference as he saved Diangana’s effort – the only miss – before Christian Norgaard scored to send Brentford through.