Centuries from Ateeq Javid and Laurie Evans left Warwickshire in a commanding position as Somerset were battling to stay in contention at Edgbaston on day three of their Division One clash.
Left-arm spinner George Dockrell took 6-96 for Somerset as the defending Division One champions were finally dismissed for 407 in their first innings.
The visitors went on to wipe away the deficit of 67 through an opening stand of 81 between Marcus Trescothick and Nick Comption.
With a new three-year contract announced before play, Compton took the first opportunity to underline his commitment with an unbeaten 83 as the visitors amassed 133-2 at stumps.
Trescothick's precarious form continued when he was caught at slip off Jeetan Patel for just 27 and Chris Jones was needlessly run out for 16, but relegation-threatened Somerset take a lead of 66 into the final day.
At the start the day, the Javid-Evans partnership resumed, thwarting Somerset's progress. But having waited almost 24 hours for a wicket, they took three in 10 overs and later closed the innings at a gallop when Dockrell pocketed the last four in 45 balls.
The wearing pitch, in its fifth day of action since the Friends Life t20 finals on Saturday, had produced its 2,000th run when Evans finally departed - LBW to Peter Trego - for 138, hitting 23 fours in the process.
Alfonso Thomas took the wicket of Tim Ambrose, who was trapped lbw for 12, before Rikki Clarke was run out in the same over as Warwickshire's innings drew to a close.
With focus 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 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 cleaned 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.
Compton will resume unbeaten alongside Dockrell on Friday with Somerset needing early runs if they are to prevent Warwickshire taking the spoils.