Widnes were 18-6 up after 30 minutes with tries from Aaron Heremaia, Lloyd White and Chris Houston, James Saltonstall replying for the hosts.
Adam Robinson crossed just before half-time for Halifax, who levelled with Miles Greenwood's try after the break.
But Charly Runciman and Jay Chapelow scored late on to send Widnes through.
Halifax head coach Richard Marshall: "A few calls didn't go our way, and there were a couple of forward passes in a couple of the build-ups to one, possibly two tries.
"It's tough to lose because I thought we were the better team."
Widnes head coach Denis Betts: "It wasn't as comfortable as I wanted it to be, but it was all the things we expected.
"I am happy but relieved at the same time because it was a very tough encounter."
Halifax: Greenwood; Sharp, Smeaton, Tyrer, Saltonstall; C. Robinson, Murrell; Bennion, B. Moore, Tangata, Manning, Heaton, Fairbank.
Replacements: Johnston, Kaye, R. Moore, A. Robinson.
Widnes: Hanbury, Thompson, Runciman, Dean, Chamberlain, Mellor, Heremaia, Cahill, White, Dudson, Houston, Sa, Leuluai.
Replacements: Manuokafoa, Whitley, J. Chapelhow, Johnstone.
Referee: Mike Woodhead
Super League side Widnes Vikings held off a comeback from Championship outfit Halifax to reach the last eight of the Challenge Cup.