A ninth win in 10 matches lifted in-form St Helens up to third in Super League and assured Keiron Cunningham's men of a place in the top four.
After their season reached a low point with four successive defeats in rounds 15 to 18, Saints have turned things around in sensational fashion, this latest success their ninth in 10 matches.
Luke Dorn scored one try and laid on another for Wigan loanee Ryan Hampshire as the visitors started brightly on Thursday, but Daryl Powell's men were guilty of frequent errors in the remainder of the first half, enabling Saints to open up a 24-10 lead.
Matty Fleming crossed in between Castleford's two early touchdowns, before converted scores from Morgan Knowles, Kyle Amor and Luke Thompson put St Helens firmly in charge.
Louie McCarthy-Scarsbrook and Adam Swift added further home tries after the interval, while depleted Castleford's misery was compounded by injuries to Junior Moors and Denny Solomona - Super League's leading try-scorer.
A late try from Will Maher represented little consolation for the Tigers, who already had nothing more than pride to play for, and Saints had the final say through Alex Walmsley.
St Helens move ahead of Wigan on points difference, prior to the Warriors' visit to Hull FC on Friday, and appear to have hit form at the right time as the Grand Final draws near.