Bristol substitute Madigan failed to find the target with two long-range efforts, while Sale scrum-half De Klerk hit the post with just seconds remaining.
Sale's Gallagher Premiership play-off hopes will be over if Northampton claim a bonus-point victory over Worcester on Saturday, although Champions Cup qualification remains a strong possibility.
Tries by wing Denny Solomona and De Klerk edged Sale ahead in front of a 20,000 crowd, while De Klerk added a penalty and his half-back partner AJ MacGinty kicked two conversions and a penalty.
The result effectively ended Bristol's hopes of a top-six finish, even though they went close, matching Sale on tries through touchdowns by full-back Charles Piutau and Alapati Leiua, while fly-half Callum Sheedy kicked seven points.
Former New Zealand full-back Piutau returned after recovering from a calf injury for Bristol, and his brother Siale Piutau featured in midfield, replacing an injured Sam Bedlow.
Sale, meanwhile, were forced into a reshuffle with centre James O'Connor sidelined after suffering a neck injury during the warm-up.
Luke James moved from full-back to centre, Chris Ashton wore the number 15 shirt and Aaron Reed started in Ashton's familiar left-wing position.
Despite the late disruption, Sale made a strong start and they went ahead after 10 minutes through an interception try.
Sheedy tried to move possession wide just inside Sale's half, but the ball went straight to Solomona, who sprinted 60 metres unopposed, with MacGinty converting for a 7-0 lead.
MacGinty kicked a penalty to increase Sale's advantage, and Bristol could only reflect on a poor opening quarter that saw frequently poor tactical kicking and wrong options in attack.
Bristol needed a response, and it arrived 10 minutes before half-time following relentless pressure by their forwards from two attacking lineouts after the home side sacrificed kicks at goal.
And their sense of adventure was rewarded as they finally exploited a gap in Sale's well-organised defence, with Piutau touching down for a try that Sheedy converted.
De Klerk's long-range strike gave Sale some breathing space again, but a Sheedy penalty cancelled that out just before the break and Sale led 13-10.
The visitors took less than two minutes of the second half to breach Bristol's defence, breaking them open through flanker Ben Curry's powerful run, before his inside pass found De Klerk, who finished impressively.
MacGinty converted from the touchline, yet Bristol hit back from their next attack, stretching Sale wide before Leiua squeezed over in the corner.
Referee Matt Carley required confirmation from the television match official before awarding it, and then Sheedy landed a touchline conversion to make it a three-point game once more.
Bristol thought they had gone ahead 12 minutes from time thanks to a brilliant solo effort by Leiua, but referee Matt Carley disallowed it following a tussle between Sheedy and Ashton during the build-up.
Ashton initiated contact with the Bristol player, who then pulled Ashton's shirt over his head as Leiua sprinted clear unopposed.
Another Sheedy penalty tied the game up with nine minutes left, but Madigan was then twice off target as Sale finished the game with 14 men after their skipper Jono Ross was sin-binned for a dangerous clear-out at a ruck.
And then De Klerk had his match-winning chance, but his penalty hit the post during a frenzied finale.