Somerset's batsmen made an improved showing second time around to keep their hopes alive at the halfway stage of the relegation clash with Derbyshire at Taunton.
Marcus Trescothick (57), James Hildreth (81) and Nick Compton all hit half-centuries as Somerset closed on 231-4 in their second innings, a lead of 36.
Compton remained unbeaten on 64 at the close but the loss of Craig Kieswetter (16) to the final ball of the day - bowled attempting to cut a delivery from part-time leg-spinner Shivnarine Chanderpaul - ensured Derbyshire remain in the stronger position to press for their third win of the season.
Somerset leg-spinner Piyush Chawla had earlier claimed 5-111 as Derbyshire went from an overnight 231-4 to 298 all out in their first innings.
Veteran seamer Alfonso Thomas (3-52) took three of the wickets to fall, including Tom Poynton for 57, while Chawla bowled Richard Johnson (68) to complete his five-wicket haul.
Tim Groenewald, who had taken 5-33 as Somerset were dismissed for 103 after choosing to bat on day one, hit an unbeaten 36 but narrowly failed to get Derbyshire up to a third batting bonus point.
Derbyshire came into the match bottom of Division One, 17 points behind seventh-placed Somerset. Surrey sit between them in the second relegation place, although they have a game in hand on both.