Sale Sharks substitute Arron Reed scored a last-minute try to win a thrilling game after Bath threatened to pull off a sensational comeback victory.
Sale had led by 19 points in the first half, but trailed as the clock ticked to zero before Reed touched down to strengthen their grip on second place in the Premiership.
They had secured a bonus point after 32 minutes with tries from Joe Carpenter, Sam Dugdale, Tom Roebuck and Tommy Taylor and looked set for an easy home win.
But Bath, who remain tenth, fought back superbly with scores from Niall Annett, Jonathan Joseph and captain Ben Spencer as they chased an unlikely away win.
However late it came, the result was enough for Sale to reduce the gap on Premiership leaders Saracens to four points.
They bowed out of the Heineken Champions Cup last weekend with defeat at Ulster but the first 30 minutes showed their credentials as a growing Premiership force.
Carpenter got it started after a fluid move from the home side within a minute of Bath losing winger Will Butt to a yellow card for a high challenge on him.
That allowed the first look at the shot clock in Premiership Rugby with Rob du Preez, on his 100th Sharks appearance, given 90 seconds to take the conversion - which he missed.
Then at the other end Spencer had 60 seconds for his penalty with the crowd able to watch the countdown as the Bath skipper slotted between the posts.
The hosts were without four players preparing for the Six Nations with England, and one of the replacements, Dugdale, grabbed the second try following a catch and drive from a line-out.
Winger Roebuck added a third in the corner and hooker Taylor had the bonus-point score well before half-time as Sale's power up front overwhelmed their opponents.
But from a position of complete dominance, the 19-point lead turned into a two-point deficit.
Annett went over at the end of the first half, before Joseph touched down following an electric burst of pace through the middle, a reminder of the player who scored 17 tries for England.
Bath withstood yellow cards to Max Ojomoh and Cameron Redpath before a brilliant piece of play from the Scotland centre, with a fantastic kick over the defence, set up Spencer.
The skipper then converted his own try from in front of the posts to put his side ahead.
Rob du Preez missed two penalties to put Sale back in front, but there was just enough time for a slick move involving Raffi Quirke and Carpenter for Reed to grab the decisive score.
Victory moves Sale 17 points ahead of third-placed Harlequins and on course for a home semi-final in the play-offs.
Despite being only one place off the bottom of the table, Bath are now just seven points behind Quins.
Sale Sharks head coach Alex Sanderson:
"When we look back on this season, if we are lucky enough to earn ourselves a home semi it's on nights like tonight, so it's quite significant.
"It was our ninth week of top-level European and Premiership games, so I knew we would be digging in, really digging in second half and we did, and we came through.
"You see how much it matters to them, how they are fighting for each other. That is the privilege of coaching when the group feels as tight as it does."
Bath head coach Johann van Graan:
"That is a difficult one to take, especially after the way we fought back and got ourselves ahead.
"That is the difficult thing about sport. You are one play away from beating them away from home, but it wasn't to be. I'm gutted but proud."
Sale Sharks: Carpenter; Roebuck, S James, Mills, O'Flaherty; R du Preez, Warr; McIntyre, Taylor, Schonert, Wiese, Beaumont, Ross (cap), JL du Preez.
Replacements: Ashman, Harrison, Jones, Groves, Birch, Quirke, L James, Reed.
Bath: Gallagher; Cokanasiga, Joseph, Ojomoh, Butt; Bailey, B Spencer; Morozov, Annett, Rae, Attwood, McNally, Hill, Cloete, Reid.
Replacements: Doughty, Obano, Jonker, W Spencer, Warner, Schreuder, Redpath, Underhill.
Referee: Karl Dickson.