Gloucestershire 263 and 97 for 4 (Price 44*) need another 400 runs to beat Yorkshire 326 (Masood 140, Akhter 5-85) and 434 for 6 dec (Lyth 113, Bean 73, Brook 68, Hill 58, Root 51)
An Adam Lyth hundred and fluent half-centuries from England's Joe Root and Harry Brook strengthened Yorkshire's grip on the third day of the Vitality County Championship match with Gloucestershire at the Seat Unique Stadium, Bristol.
Starting the day on 57 without loss in their second innings, with a lead of 120, the visitors ran up 434 for six before declaring in the final session, setting their opponents a highly unlikely 498 to win. Lyth top-scored with 113, while Root contributed 51, Brook 68 and George Hill 58.
By the close, Gloucestershire had slumped to 97 for four, Ollie Price unbeaten on 44. Heavy rain is forecast overnight, but may not be enough to save a team without a Championship win for 19 months.
Lyth was unbeaten on 39 when play began and soon moved to a flawless fifty off 61 balls, with nine fours. Finlay Bean hooked Marchant de Lange for six over fine leg, demonstrating his team's desire for quick runs.
Bean went to a half-century off 78 balls before Lyth upped the tempo further by striking three fours through the off-side off consecutive deliveries from de Lange.
Lyth had just one anxious moment, surviving a confident appeal for a catch behind off de Lange when on 93, before reaching a 120-ball hundred, compiled in seemingly effortless style with 18 fours.
The opening partnership had reached 180 in the 38th over when Gloucestershire skipper Graeme van Buuren struck with only his fourth ball of the day. The left-arm spinner pinned Bean leg-before as he attempted a forcing shot off the back foot.
It was 194 for one at lunch, with Yorkshire leading by 257, and the only question was how long they would choose to bat. It proved to be all through the afternoon session and beyond in bright sunshine.
Lyth fell to a catch at short third-man off van Buuren, attempting a reverse-sweep and the Gloucestershire skipper claimed a third wicket when first-innings centurion Shan Masood, who had moved smoothly to 40 off 52 balls, was brilliantly stumped by James Bracey off a delivery that went between his legs, momentarily unsighting the wicketkeeper.
By then Yorkshire were 272 for three, with Root well set. His only blemish was an attempted reverse-scoop off Josh Shaw that only made sufficient contact to score a single over Bracey's head as he progressed serenely to fifty off 56 balls, with four fours and a six.
With a single added to his score, Root fell to more Bracey brilliance as the keeper dived full-length to his left to hold a one-handed leg-side catch off Zaman Akhter. Brook went to a chanceless half-century and was unbeaten on 51 when tea was taken at 365 for four.
He had faced 57 balls, striking nine fours and a six when caught at deep mid-wicket off de Lange. Still Yorkshire batted on, with their lead 456, and Hill joined in the array of attacking shots, hitting five fours and a six in his 54-ball fifty before being caught at wide long-on off Price.
Gloucestershire were left with 26 overs to bat in the day when Masood made the declaration. Their second innings got off to a poor start when Chris Dent, on five, went to clip a ball from Ben Coad off his pads and directed it straight to Bean at leg-slip.
Cameron Bancroft and Price added 41 without alarm until Bancroft, on eight, was caught behind aiming to drive Matt Milnes. Miles Hammond came in and immediately went on the attack.
The left-hander smacked five fours and a six in racing to 35, but his approach was inappropriate for a side looking to save the game and he perished attempting another big hit, caught at mid-wicket by Brook off the left-arm spin of Dan Moriarty with less than three overs left in the day.
Nightwatchman Josh Shaw lasted just six balls before falling lbw to Matt Fisher and Gloucestershire had thrown away a position which might have given them hope on the final day.