Somerset 288 and 139 for 3 (Rew 58*, Abell 27*, Baker 3-29) need 148 runs to beat Hampshire 238 and 336 (Gubbins 83, Brown 66, Lehmann 50, Gregory 5-42)
James Rew passed 50 for the fourth time in five Rothesay County Championship innings as Somerset put themselves on course to beat Hampshire.
The eye-catching Rew, whose head coach Jason Kerr touted for England honours this summer, followed his 86 in the first innings to end the day 58 not out.
That followed scores of 64, 122 and 48 in his other three innings this season - with Somerset 148 runs away from chasing 288, with seven wickets still in hand.
Lewis Gregory had earlier taken his first five-wicket haul in three years to restrict Hampshire, despite half-centuries for Nick Gubbins, Jake Lehmann and Ben Brown.
Over the first two days, Somerset were seemingly in complete control before Hampshire fought back and put their noses in front - all while the pitch swung back and forth from favouring the bat to the ball.
Sunday's morning session saw neither side find match momentum, as Hampshire grew their 96-run overnight lead to 215 against an ageing ball, but three wickets kept them in check.
Despite Lehmann and Rew looking likely, no player had managed to reach three figures in the first two innings.
Like the two previous contenders, Nick Gubbins looked destined to reach three figures. It didn't pan out that way. A perfectly played reverse sweep off Jack Leach took him to 83 but he jabbed outside next ball to depart.
Australian Lehmann was the next to try and buck the trend. He reached a half-century, for the second time in the match, with another punchy selection of drives and pulls. He raised his bat and without scoring another run, chopped the pacy Alfie Ogborne onto his own stumps.
Opener Toby Albert retired hurt after he had extended his knee when taking a quick single on the second evening, his return was short-lived as Gregory had him leg-before.
Ben Mayes was bowled through the gate by Archie Vaughan, but Somerset wrestled back the advantage with the second new ball.
Vaughan tempted Liam Dawson into a loose leg side shot, before Gregory brought himself on, found good movement and four more wickets.
Ben Brown was the latest candidate to try and break the century curse, but was stopped on 66 by an inswinger.
Kyle Abbott and Eddie Jack were also bowled, before Sonny Baker was lbw - Gregory returning from a pectoral injury that had ruled him out the opening two rounds in style.
This was his first five-wicket haul against Hampshire, despite taking more wickets against this opponent than any other in first-class matches. In his six overs with the second new ball, during which he swapped ends, he took four wickets for five runs, with overall figures of five for 42.
Vaughan saw the 287 target as one to attack, despite there being plenty of time left in the match. The opener got the chase against Essex done and dusted in quick time, and struck six boundaries in his 30 before taking on a Baker short ball and losing for the second time in the match.
Baker swapped ends and removed the rest of the Somerset top order. Josh Thomas was plumb in front and then Tom Lammonby hooked straight to deep square leg.
Not for the first time in the match, or the season, Somerset looked to Rew and Tom Abell to build an important partnership - they once again answered with runs. The pair put on 87, after 101 in the first innings, with Rew doing the majority of the run scoring.
