Bath came out on top in an error-filled Premiership contest at The Rec, eventually winning 22-12 on Saturday.
Harlequins outscored the hosts by two tries to one, but the trusty boot of Rhys Priestland kicked his side to victory and denied the visitors a losing bonus point.
Tim Visser and Marland Yarde carried over for John Kingston’s men, with Bath’s reply coming though Max Clark.
An early shot at the posts allowed Priestland to kick the home side in front, before doubling the lead on 15 minutes following a scrum penalty in Bath’s favour.
Despite Bath’s early dominance, the game’s first try went the way of Harlequins as quick hands through the backs allowed wing Visser to go over in the corner under the challenge of Bath’s Priestland.
Ruaraidh Jackson added the extras from the touchline to put the visitors in to the lead, but Bath’s fly-half restored their lead just before the break with a third three-pointer.
The early knockings of the second half saw the London side regain their lead when Rob Buchanan found himself making ground of the wing. Kahn Fotuali’i was able to stop the hooker, but couldn’t prevent the offload to wing Yarde who scored the unconverted try.
The hour mark saw the introduction of loosehead prop Beno Obano, who had an immediate impact with a number of carries round the corner after a break from Priestland.
His efforts eventually gave Clark the platform to carry over and restore Bath’s lead, with the Welshman adding the extras to make it 16-12.
Two late penalties from Wales international Priestland ensured that Todd Blackadder’s men ground out the result to keep them in the play-offs spots.
Pens: Priestland 5
Try: Visser, Yarde
Bath: 15 Tom Homer, 14 Semesa Rokoduguni, 13 Max Clark, 12 Rory Jennings, 11 Jack Wilson, 10 Rhys Priestland (cc), 9 Kahn Fotuali’i, 8 Taulupe Faletau, 7 Francois Louw (cc), 6 David Denton, 5 Charlie Ewels, 4 Elliott Stooke, 3 Max Lahiff, 2 Tom Dunn, 1 Nathan Catt
Replacements: 16 Ross Batty, 17 Beno Obano, 18 Kane Palma-Newport, 19 Tom Ellis, 20 Paul Grant, 21 Chris Cook, 22 Adam Hastings, 23 Harry Davies
Harlequins: 15 Aaron Morris, 14 Marland Yarde, 13 Joe Marchant, 12 Matt Hopper, 11 Tim Visser, 10 Ruaridh Jackson, 9 Charlie Mulchrone, 8 Mat Luamanu, 7 Dave Ward (c), 6 James Chisholm, 5 Charlie Matthews, 4 Mark Reddish, 3 Adam Jones, 2 Rob Buchanan, 1 Owen Evans
Replacements: 16 Joe Gray, 17 Tyler Gendall, 18 Matt Shields, 19 George Merrick, 20 George Naoupu, 21 Luc Jones, 22 Nick Evans, 23 Alofa Alofa
Referee: Craig Maxwell-Keys
Assistant Referees: Tim Wigglesworth, Rogers Baileff
TMO: David Rose