Harlequins survived a late second-half surge from Bath to avoid a third straight Premiership defeat by claiming a 35-28 victory at The Stoop on Friday.
Two Ben Botica penalties and a Harry Sloan try helped give Harlequins an 11-6 lead early in the first half before Bath's Chris Cook was sin-binned six minutes before half-time.
The hosts capitalised on their numerical advantage and just five minutes into the second half held a commanding 29-point lead thanks in part to a Charlie Walker double.
Amanaki Mafi, Jeff Williams and Semesa Rokoduguni all crossed after Harlequins' Sam Twomey was sent to the sin bin as Bath scored three tries in the space of seven minutes to reduce the gap to 10 points.
But the visitors could not complete an incredible fightback despite James Horwill being shown a yellow card three minutes from time for Harlequins, although Tom Homer's late penalty did ensure Bath collected a bonus point for their efforts.
Harlequins' bonus-point victory moves them at least temporarily from eighth to fourth, while Bath remain ninth.