Derbyshire claimed two late wickets - including one with the final ball of the day - to stall the Somerset fightback and keep the match in the balance after Day Two at Taunton.
Tim Groenewald (36 not out) and Mark Footitt (11) shared a 42-run last wicket stand to help Derbyshire recover from 256-9 to 298 all out just before lunch.
A century partnership between Nick Compton (64 not out) and James Hildreth (88), however, helped the hosts to chalk off their 195-run deficit for the loss of just two wickets.
But two late wickets - one apiece for David Wainwright (1-62) and Shivnarine Chanderpaul (1-9) - have left the match finely poised with Somerset 231-4, a lead of 36 runs.
Resuming on 220-5, Derbyshire added 78 more runs in the morning session to secure a 195-run lead.
Building on an astonishing opening day - in which the visitors dismissed Somerset for just 103 inside 34 overs - Tom Poynton and Richard Johnson completed a century partnership, before the former was the first man out on 57, caught behind off Alfonso Thomas.
Thomas (3-52) produced an inspired spell claiming three wickets, before Piyush Chawla bowled Johnson - who top scored with 68 - to reduce the visitors to 256-9.
But the final wicket pair of Groenewald and Footitt remained firm and added 42 valuable runs to end on 298.
Somerset, however, fared much better in their second innings thanks to 57 from Marcus Trescothick and a 116-run partnership between Compton and Hildreth.
Hildreth struck eight fours and a six to compile the highest score of the match (88), before he was bowled by Wainwright. Partner Compton remained defiant to end the day unbeaten on 64 with Somerset 231-4, a lead of 36 runs with six second innings wickets remaining.
© 2014 Derbyshire County Cricket Club
The County Ground, Grandstand Road, Derby DE21 6AF. Tel: 01332 388 101
Website design by: www.thisismedia.co.uk