Gloucestershire 261 (Payne 56, Keogh 4-67) and 35 for 2 require a further 407 runs to beat Northants 326 (Newton 130, Wakely 104, Payne 4-57) and 376 (Levi 95, Duckett 70)
Richard Levi's 95 helped put Northamptonshire on course for a fourth win of the season as they set Gloucestershire 442 to win at Wantage Road. The hosts were bowled out for 376 in their second-innings before Gloucestershire closed day three at 35 for 2.
Gloucestershire were sent in for 16 overs to the close and they lost Gareth Roderick for 19, who edged a good length delivery from Ben Sanderson that just held its line, and Will Tavare, who tried to play a back-foot push and was caught at second slip for a nine-ball duck.
Northants' position was set up by Levi, whose only other innings of note in the County Championship came in the third match of his injury-hit season with a century against Derbyshire. He steered his side into control of the game with a confident 114-ball innings with 15 fours.
At 155 for 4 shortly after lunch, Gloucestershire sensed a way back into the game but Levi shared a stand of 71 with Adam Rossington for the fifth wicket and 76 with Steven Crook for the sixth.
Rossington missed a sweep at Jack Taylor and was lbw for 34 before Levi, five short of a pleasing century, pushed into the off side and called for a single that Crook disagreed with as Will Tavare dived to his left to make a sharp save. Levi was three-quarters of the way down the wicket and gave up any chance to recover his ground. Tavare had time for a cup of tea before returning a throw to Phil Mustard.
Earlier in the day, Northants resumed 44 for 0 and Ben Duckett made his way to 70 in the final innings of a wondrous 2016 season.
Having struck five fours to reach 31 not out by the close on day two, he began the third day in typically aggressive touch. An extra-cover drive against Liam Norwell was the stroke of the morning as he passed fifty in 59 balls with eight fours.
But when a fifth hundred of the season looked possible, Matt Taylor made a ball jump and take the splice of the bat, providing a catch to George Hankins at point.
Duckett walked off to a great ovation having scored 1,338 County Championship runs at 60.81 with four centuries - and two doubles - this season.
Rob Newton was also out on the third morning, edging Matt Taylor to slip after an opening stand of 116 with Duckett and in the over before lunch Alex Wakely edged David Payne to second slip to keep Gloucestershire in the game. Levi's afternoon ensured it was the hosts who took control.