Somerset respond well to twin tons
Watch highlights of day three between Warwickshire and Somerset
Somerset slowly battled back into contention after Warwickshire century-makers Ateeq Javid and Laurie Evans had completed a partnership of 269 in the LV= County Championship clash at Edgbaston.
Left-arm spinner George Dockrell returned 6-96 as the Division One champions were dismissed for 407 and Somerset cleared off a deficit of 67 during an opening stand of 81 by Marcus Trescothick and Nick Compton.
With a new three-year contract announced before play, Compton took the first opportunity to underline his commitment with an unbeaten 83 out of at the close. This was his sixth time past 50 in seven first-class matches since his last Test appearance in May.
Trescothick's sketchy form continued when he was caught at slip off Jeetan Patel for 27 and Chris Jones was needlessly run out for 16 but the relegation-threatened West Country side will take a lead of 66 into the final day.
If this is pushed beyond 200, they could be in business - particularly with a bigger contribution from Piyush Chawla in support of Dockrell. The newly signed leg-spinner was out of touch with 0-108 in the first innings.
At the start the day, the Javid-Evans stand continued to hold up Somerset. However, having waited almost 24 hours for a wicket, the visitors took three in 10 overs and later closed the innings at a gallop when Dockrell pocketed the last four in 45 balls.
The much-used pitch, in its fifth day of cricket since Friends Life t20 finals day on Saturday, had just produced its 2,000th run when Evans finally departed for 138 after playing with some style for 23 fours.
A chanceless innings ended with a leg-before dismissal when Peter Trego found a hint of swing, but Somerset had to wait a good while longer to break Javid's impressive levels of concentration.
However they did make some progress with two wickets in an over from Alfonso Thomas. Tim Ambrose was lbw for 12 but Rikki Clarke was unlucky to be run out by a bowler's deflection when backing up.
In focussing on a big total, Warwickshire sacrificed a couple of bonus points but the plan backfired when Dockrell finally took full profit for his control and perseverance.
Conceding only nine boundaries in 43.4 overs, the Irishman finally found a chink in Javid's patience when the 21-year-old edged to Craig Kieswetter after making 133 in a mature performance spanning seven hours.
Dockrell then mopped up with a couple of stumpings - Kieswetter's glovework accounting for Keith Barker and Jeetan Patel - and a tame drive to mid-on by Tom Milnes.
Veteran Darren Maddy was left unbeaten with 40 in one of his last appearances before retiring at the end of the season.