Sale missed out on a European Champions Cup spot despite beating Gloucester in a match which featured 13 tries.
Both sides secured a bonus-point in the first half, with the Cherry and Whites going in 26-24 ahead.
Byron McGuigan edged Sale in front but converted tries from Dom Coetzer and Ben Vellacott, along with a Lloyd Evans penalty, put the visitors 41-31 up.
But AJ MacGinty and Denny Solomona crossed before MacGinty's late penalty sealed the Sharks' victory.
Gloucester, who were already assured of third place heading into the match, will now face Saracens in the semi-finals at Allianz Park next Saturday (13:30 BST) after the north Londoners were beaten at Worcester to finish second behind Exeter.
The visitors played their part in an open first half as both teams scored four tries before the break for just the second time in Premiership history, emulating London Irish's win at Wasps in April 2006.
In a see-saw match, in which the lead changed hands six times, Solomona's acrobatic finish following a break from Faf de Klerk and a long pass from MacGinty was arguably the pick of the tries.
Sale appeared set to snatch sixth place but Bath's last-gasp win at Leicester meant Steve Diamond's side had to settle for seventh.
However, the Sharks could yet be handed European Champions Cup qualification depending on end-of-season results in France's Top 14.
Gloucester director of rugby Johan Ackermann told BBC Radio Gloucestershire:
"We had a lot of new combinations, players who have not had a lot of game time in the last few weeks and young players having a taste.
"They never let us down and were in the match the whole time. We maybe could have won it at the end but it was not about the result.
"It was about the effort, heart and commitment so I am proud of the performance.
"Sharks are a good team and had a lot to play for. Yes, we made mistakes - and probably made it harder for ourselves - but it is about the culture we wanted to install."
Sale: Ashton; Solomona, S James, O'Connor, McGuigan; MacGinty, De Klerk; Harrison, Webber, John, Beaumont, Phillips, B Curry, T Curry, Ross (capt).
Replacements: Langdon, Morozov, Jones, Evans, Strauss, Cliff, L James, Reed.
Gloucester: Sharples; Seabrook, Purdy, Banahan, Thorley; L Evans, Braley; Traynor, Walker, Denman, Savage (capt), Grobler, Polledri, Ludlow, G Evans.
Replacements: Gleave, Seville, McAllister, Craig, Hinkley, Vellacott, Coetzer, Marshall.
Referee: Wayne Barnes.