Gloucestershire 438 and 37 for 5 (Duffy 4-8) trail Kent 564 (Cox 158, Leaning 128, Bell-Drummond 89, Compton 80, T. Price 5-58) by 89 runs
Kent are scenting a first win of the LV= Insurance County Championship season at Canterbury, after a late salvo by Jacob Duffy
reduced Gloucestershire to 37 for 5 after day three, still 89 behind the hosts' first-innings total of 564.
Matt Quinn started the visitors' collapse when he removed George Scott for 10 and New Zealander Duffy then took 4 for 8 to leave Gloucestershire reeling at stumps.
Earlier, Jordan Cox
made 158 and Jack Leaning
128 in a record Kent stand for the fourth-wicket against Gloucestershire.
After two and half days in which the bowlers struggled to make any impact, Tom Price
took a hat-trick and career-best figures of 5 for 53, but wickets continued to tumble through the evening session, with Chris Dent and Miles Hammond clinging on at the close of play on 8 and 0 not out respectively.
Kent began day three on 232 for 3, needing another 57 to avoid the follow on, a landmark they sailed past despite Gloucestershire taking the new ball after the first over.
Leaning carved Tom Price for four through backward point to pass 50 while Cox reached his half-century with a nudged single off Zafar Gohar.
It was 337 for 3 at lunch and Cox won the race to three figures with a flamboyant reverse-sweep for four off Hammond. In the next over Leaning, who'd been ahead of his colleague for most of the session, scrambled a single to bring up his seventh first-class hundred.
A cut shot from Cox off Ajeet Dale saw Kent move into the lead, and the duo then passed the previous fourth-wicket record of 233 set by Colin Cowdrey and Brian Luckhurst in 1962, before the stand finally came to an end when Leaning pulled Gohar to Ollie Price at square leg.
Having reached 468 for 4 at tea, Kent had moved to 511 when they lost two wickets from two balls. Price had Cox caught behind and then sent George Linde's off stump flying. After a maiden over from Gohar, Price returned to trap Grant Stewart lbw for his hat-trick, but Kent regained the initiative when Matt Milnes joined Sam Billings and the duo put on a rapid 53.
Milnes' 37 included successive sixes and a four from Gohar in the final over before the second new ball was taken, but he then hit Price to Hammond. Price then sent Duffy's middle stump cartwheeling for a second-ball duck, but when Billings was also bowled middle stump by Dale for 43 it left Gloucestershire with a dicey nine-over spell to survive before stumps.
Scott subsequently edged Quinn to Cox at second slip and Billings took a brilliant diving catch down the leg side from Duffy's first delivery to remove Bracey.
Duffy then charged down the wicket to catch night-watcher Zak Chappell for eight and his next delivery had Dale caught by Ben Compton for a golden duck. Tom Price survived the hat-trick ball, but the next delivery clipped his bails to leaving Kent in a euphoric mood at the close.