Gloucestershire 343 and 246 for 5 (Charlesworth 64, O. Price 53, Hammond 53) lead Somerset 248 (Imam-ul-Haq 90, Rew 44*, T. Price 5-75) by 341 runs
Half-centuries from Ben Charlesworth, Ollie Price and Miles Hammond left Gloucestershire poised for a challenging declaration on the third day of the LV= Insurance County Championship match with Somerset at Taunton.
The visitors began the day by bowling out their arch-rivals for 248, from an overnight 209 for 8, Tom Price completing figures of 5 for 75.
That gave Gloucestershire a first-innings lead of 95, which they cemented by scoring 246 for 5 in their second innings, Charlesworth contributing 64, Price 52 and Hammond 53.
A deficit of 341 will mean a testing final day for Somerset's fragile batting line-up if the thunderstorms that have been forecast throughout the game continue to stay away.
After the start of play had been delayed by ten minutes following rain, the hosts added only four to their overnight score before Sajid Khan was caught behind looking to guide a short ball from David Payne over the slips.
The Pakistan off-spinner made it clear he did not agree with the decision, repeatedly pointing to his shoulder as the contact point.
James Rew, unbeaten on 35 at the start, and Jack Brooks added 35 for the last wicket, the latter top-edging a six off Price before falling for 21 to the next delivery, caught at third slip.
Teenager Rew finished unbeaten on 44 after nearly four hours of intense concentration. But Somerset fell two runs short of a second batting point and soon their seamers were again struggling to find any assistance from the Cooper Associates County Ground pitch.
Charlesworth and Marcus Harris took the Gloucestershire second-innings score to 35 before Harris was bowled off stump by a good delivery from Josh Davey.
By lunch, the score had progressed to 49 for 1 and the visitors led by 144. Soon Charlesworth and Ollie Price were building on it comfortably in the afternoon sunshine.
Price went to his second half-century of the match, off 97 balls, with nine fours, before becoming a first Somerset victim for Sajid, caught at slip attempting a reverse sweep.
Sajid bowled tightly from the River End until Hammond launched him for a straight six and had figures of 1 for 39 from 17 overs at tea, which was taken with Gloucestershire 143 for 2.
The lead was 238 and Charlesworth was four short of fifty. The tall left-hander remained patient at the start of the final session and reached the landmark off 179 balls, with 4 fours.
Sajid continued to show excellent control and there was no urgency to Gloucestershire's batting, with Charlesworth and Hammond content to accumulate steadily.
The floodlights were turned on with 18 overs still left in the day's play. Tom Lammonby supported Sajid with a tight spell of left-arm seam and claimed the wicket of Charlesworth, caught at slip driving with the score on 192.
The stand with Hammond had added 68, but occupied 32.2 overs at a time when their team might have pressed for a declaration before the close.
With Gloucestershire's innings becalmed, Somerset opted not to take the second new ball at 196 for 3. Brooks replaced Lammonby, who had conceded just 14 runs from ten overs.
The stranglehold was broken as Brooks' first two overs cost 14. James Bracey survived a stumping chance off Sajid in a bid to further lift the tempo.
Hammond moved to a watchful half-century off 137 balls, with 3 fours and 2 sixes, before Bracey fell to a stunning Kasey Aldridge catch off his own bowling, the tall seamer diving to his right to take the ball an inch off the ground.
At 218 for 4, Gloucestershire led by 313. Skipper Graeme van Buuren wasted no time extending the advantage with a six over long-on off Sajid.
Hammond was caught at slip to give Sajid a second wicket and Somerset could take some comfort from having restricted their neighbours to a run rate of just 2.67 an over.