Colchester United 2 Hartlepool United 0
Visiting Hartlepool, who are deep in the relegation mire, struck the woodwork three times and also had defender Darren Williams sent off for two bookable offences on the hour mark.
But the visitors looked like they could hold on for a precious point until the livewire Danns obliged with his two crucial goals in the 83rd and 90th minutes.
The U's had only scored two goals in their previous 10 league games to see them drift off the pace near the top of League One.
But Danns ensured that they cashed in on their game in hand to move within one point of second-placed Brentford.
Danns broke the deadlock with just seven minutes remaining when he met a cross by Mark Yeates with a bullet header that gave Greek keeper Dimitrios Konstantopoulos no chance.
Danns had actually struck the woodwork just seconds before with another header and he duly completed his brace in the last minute of normal time to ensure that there would be no nervous finale for the Layer Road crowd.
Midfielder Kevin Watson and substitute Billy Clarke combined to set up Danns, who fired into an empty net to rattle up his 16th goal of a successful season.
There was still time for Hartlepool to strike the woodwork for their third time in the match when substitute Eifion Williams rattled the bar from 25 yards out.
Colchester had dominated the first half but they nearly fell behind early in the second period when Lee Bullock's header cannoned off the bar, prompting a terrific goalmouth scramble before the U's hacked to safety.
For the hosts, Yeates had also been denied by the woodwork earlier in the game, while Konstantopoulos came to his side's rescue with a series of excellent saves.
Hartlepool had dropped into the bottom four last weekend and their cause was not helped when right-back Williams was sent off on the hour mark.
Booked for a challenge on Yeates just two minutes earlier, he received a second yellow card and ensuing red for bringing down Ipswich Town loanee Clarke who had a fine full debut for the Essex club.