Bradford duly secured their place in the last 16 of the Carnegie Challenge Cup but the Super League leaders were given a major scare by their National League visitors.
Castleford, relegated from Super League last year, did not look out of place at Odsal and were in sight of a shock victory when two tries in a seven-minute spell midway through the second half brought them to within two points.
But New Zealand Test second rower David Solomona came to the rescue of the 2003 Cup winners with an opportunist try that finally clinched their place in Tuesday's fifth-round draw.
The Bulls were without Shontayne Hape, Jamie Langley and former Castleford favourite Michael Platt because of injury and suffered further blows with the loss of hooker Terry Newton and winger Lesley Vainikolo before half-time.
Yet they made the best of starts with a try inside two minutes. The Tigers had not handled the ball by the time Australian forward Glenn Morrison burrowed his way over from acting half-back.
But the National League side drew level on nine minutes when right winger Michael Wainwright pounced on a wayward pass from Iestyn Harris to race 50 metres for a try.
Danny Brough, drop-goal hero for Hull in their 2005 win over Leeds, added the conversion to cancel out Paul Deacon's earlier effort for the Bulls.
But the Super League leaders' class began to tell and they eased into a 12-point lead by the interval.
Second rower Chris McKenna broke clear to send full-back Marcus St Hilaire over on 19 minutes and a superb pass from Solomona got Vainikolo romping through a yawning gap three minutes before the break.
Deacon added both goals to put his side in a commanding position.
Vainikolo failed to come back for the second half and, with hooker Terry Newton also taken off midway through the first half with a knock, coach Steve McNamara may have had one eye on Thursday's Super League derby with Leeds.
Castleford might have sensed a slackening off by their opponents for they raised their game in the second half and dominated the third quarter.
Brough and former New Zealand Test forward Awen Guttenbeil in particular caused the Super League side lots of problems and it was from a 40-20 kick from Brough that the Tigers scored their second try on 52 minutes.
Some intricate passing split the Bulls defence and Michael Shenton, who had just moved from centre to the wing, took substitute Dwayne Barker's pass to dive over at the corner.
Brough was wide with the conversion but a bad handling error from Bradford winger Nathan McAvoy enabled the visitors to maintain the pressure.
And the gap was down to just two points on the hour when loose forward Peter Lupton raced onto Brough's grubber kick to the line for a third try, to which Brough added his second goal.
Solomona eased the Bradford fans' growing anxiety when he charged over from a play-the-ball close to the Castleford line and Deacon's fourth goal restored his side's eight-point lead.
Even then, the Tigers never gave up hope and Shenton went close to grabbing a second try.