Bradford (22) 38
Tries: Tadulala, Halley, Scruton, Worrincy, Burgess, Jeffries (2) Goals: Deacon 4, Sykes
Castleford (12) 40
Tries: Shenton (2), Chase (2), Thompson, Westerman, Widders Goals: Westerman (6)
Deacon had the chance to level the scores late on
Bradford's season of struggle continued as Castleford kept themselves in the play-off hunt with a narrow victory.
Bulls scrum-half Paul Deacon missed a late conversion to level the scores at the end of a topsy-turvy encounter in which both sides scored seven tries.
Castleford trailed 22-12 at the break, but a four-try blitz at the start of the second half put them in charge.
Bradford fought back bravely, but Deacon was off target with his conversion of Ben Jeffries' late try.
Castleford initially went ahead after Semi Tadulala lost a Rangi Chase kick under pressure and Michael Shenton pounced.
Tadulala soon made amends after a Castleford mistake at the restart allowed the Bulls to go straight back on the attack.
Fiji winger Tadulala was on hand to finish in the corner and a good break by Chris Nero moments later almost created a chance for Terry Newton to give the Bulls the lead.
The Tigers responded strongly with a Ryan McGoldrick pass putting Chase over by the posts and Westerman's second conversion gave the visitors a 12-4 lead.
But Bradford hit back with three more tries to take a 10-point lead into the break.
Dave Halley claimed the first of them from a Paul Deacon pass after another Tigers error at a restart offered the Bulls a way back into the game.
Newton put Nick Scruton over for his first Bulls try and Halley was denied a second when another Newton pass was ruled forward.
Halley showed his defensive qualities to keep out opposing full-back Richard Owen before the Bulls finished the first half with a flourish.
Ben Jeffries found a gap in the Tigers defence and Michael Worrincy completed the attack by outpacing Shenton and Kirk Netherton to the line.
Remarkably, Bradford surrendered their position of dominance by conceding four tries within the opening 13 minutes of the second half.
The first was almost a carbon copy of the opener as Tadulala missed a Chase kick and Shenton this time set up youngster Jordan Thompson.
Tadulala missed a tackle in Castleford's next attack and Shenton cut inside for his second.
A brilliant Halley tackle denied Mike Wainwright but the Tigers were not kept out for long as Chase sold Deacon a dummy to cross for his second.
The capitulation continued as McGoldrick sent Westerman on his way to the line with a clever pass.
The momentum shifted back in Bradford's favour as Deacon set up Burgess before Jeffries went over from a Newton pass to level the scores at 34-34.
Widders put Cas back in front by picking off a Newton pass and sprinting most of the length of the field.
There was still time for one last twist as Halley's break set up Jeffries but Deacon was unable to add the goal.
Castleford coach Terry Matterson:
"It's the most bizarre game I've ever been involved in. I don't know what to say about it, but you've just got to find a way to win.
"We've been involved in a lot of close games this year and we haven't found a way to win, so I'm really pleased.
"We haven't got a problem with attacking but we've obviously got some issues with defence."
Bradford coach Steve McNamara:
"Some people may think that was an entertaining and open game but for me it was a poor standard game.
"Both sides came up with some unbelievable errors to keep gifting the opposition opportunities.
"If both sides carry on playing like that, gifting that amount of possession and opportunities, neither side will go on and do much more."
Bradford: Halley, Sheriffe, Sykes, Nero, Tadulala, Jeffries, Deacon, Lynch, Newton, Scruton, Burgess, Menzies, Langley.
Replacements: Worrincy, Godwin, Donaldson, Kopczak.
Castleford: Owen, Thompson, Widders, Shenton, Wainwright, McGoldrick, Chase, Sargent, Jones, Higgins, Huby, Ferres, Westerman.
Replacements: Boyle, Feather, Clayton, Netherton.
Referee: B Thaler (Wakefield)