Sale secured a home play-off semi-final with a hard-fought victory over Gloucester who have now lost five Premiership games in a row.
George Ford and Adam Hastings traded penalties before Jean-Luc du Preez's try made it 10-3 to Sale at the break.
The visitors lost Tom Curry and Manu Tuilagi to yellow cards before Gloucester took the lead through Lewis Ludlow and Louis Rees-Zammit.
But Jono Ross and Sam James earned victory before Jonny May's late try.
The win means Sale, in second, cannot be caught by third-placed Leicester, while Gloucester, who were very much in the play-off picture not too long ago, now find themselves 10th after a poor end to the campaign.
After a quiet opening 10 minutes Gloucester went close to scoring when Santiago Carreras looped a long pass wide to Rees-Zammit, who looked to be coasting in before Arron Reed's excellent covering tackle put the Wales winger into touch.
England fly-half Ford scored the first points of the game after 22 minutes with a penalty after a late tackle on Gus Warr, and Hastings replied for the Cherry and Whites on the half-hour.
Sale registered the first try five minutes before the break when du Preez powered though tacklers before reaching a long arm out to score, and Ford's conversion made it 10-3.
Curry was yellow-carded two minutes before the break for an infringement at the breakdown as Gloucester broke but the visitors held out to lead by seven at the halfway stage.
Gloucester were straight back onto the front foot in the second half and their pressure told after 46 minutes when Tuilagi became the second Sale player to be sin-binned, seconds before Curry had been due to return, as he was yellow-carded for offside.
From the resulting penalty, the hosts struck with May offloading through a tackle to release Ludlow and Hastings levelled things up again at 10-10.
Gloucester took the lead for the first time after 56 minutes when Rees-Zammit was put into space by Chris Harris and this time he made no mistake as Reed's covering tackle could not stop the Welshman.
But the advantage did not last long as Ben Morgan's loose kick was run straight back up the pitch by James and Ross picked the right line to power over, with Ford's conversion making it level once again on the hour at 13-13.
Ford nudged Sale 20-17 in front with 16 minutes remaining and Ben Curry's 74th-minute turnover led to a fast break which was finished by James to take the visitors eight points clear.
Gloucester carried on plugging away in search of a losing bonus point which arrived in the last minute when May collected Hastings' cross-field kick, with the departing Billy Twelvetrees missing the conversion in his final appearance at Kingsholm.
Gloucester: Carreras, Rees-Zammit, Harris, Atkinson, May, Hastings, Varney; Vivas, McGuigan, Gotovtsev, Clarke, Alemanno, Clement, Ludlow, Morgan.
Replacements: Blake, Elrington, Ford-Robinson, Jordan, Thomas, Chapman, Twelvetrees, Hearle.
Sale: Carpenter, Roebuck, R du Preez, Tuilagi, Reed, Ford, Warr; McIntryre, van der Merwe, Schonert, JL du Preez, Hill, T Curry, B Curry, Ross.
Replacements: Ashman, Rodd, Oosthuizen, Beaumont, Dugdale, Quirke, James, McGuigan.