Unbeaten on 21 overnight, the 19-year-old shared a key ninth-wicket stand of 78 with Ben Sanderson (38) on day three as the visitors extended their first innings score from an overnight 353 for seven to 479 all out, a lead of 162.
Left-arm spinner Zafar Gohar finished with five for 134, but his efforts looked to be in vain as Gloucestershire slipped to 135 for five in their second innings, still 27 behind, by the time bad light ended play 15 overs early.
Despite a defiant 62 from Marcus Harris, the hosts were relieved when the action was curtailed, Tom Taylor having claimed two of the wickets on a wearing pitch.
Trailing by 36 runs at the start of the day, Gloucestershire needed to back their bowlers with tight fielding to restrict the deficit to a manageable level.
Instead, they dropped Sales twice when he had added only a single to his overnight score, David Payne the unlucky bowler on both occasions.
First Harris spilled a chance two-handed to his right at gully. Then Ollie Price failed to capitalise on an edge to second slip.
Despite Zafar’s four wickets on day two, Gloucestershire bowled seam for the first 11 overs, only introducing their specialist spinner after 30 runs had been added.
Three runs later he made the breakthrough, Simon Kerrigan, on 14, driving a catch to extra cover.
Sales moved to 50 with a pulled four off Zafar, having faced 121 balls and hit six fours.
Sanderson then extended the lead to three figures before the pair took 12 off the only over of the innings bowled by Gloucestershire captain Graeme van Buuren.
By lunch, Northants had reached 454 for eight, having added 101 in the morning session.
Sales' vital contribution ended when he was unlucky to edge a leg side delivery from Zak Chappell through to keeper James Bracey.
A couple of sixes by last man Jack White off Zafar added to Gloucestershire’s frustration and Sanderson was only four short of his career best score when spooning a catch to cover off Chappell.
The home side had progressed their second innings to 37 when Chris Dent departed for 16 in careless fashion, chipping a catch to short mid-wicket off Taylor.
Ollie Price was caught behind off White for a seven-ball duck and at 42 for two, Gloucestershire trailed by 116.
Harris went on the counter-attack, lofting Kerrigan for two sixes over wide long-on as he and Miles Hammond took the total to 82 for two by tea in poor light.
With only a run added, Taylor beat Hammond’s defensive shot and trapped him lbw. Harris was beaten by successive balls from Sanderson, but then took a single off him to reach a 67-ball half-century, with 2 sixes and 5 fours.
Gloucestershire’s hopes of saving the game were dealt a severe blow when Harris advanced down the pitch to Kerrigan and was bowled between bat and pad.
Bracey followed for 23, bowled by off-spinner Rob Keogh’s first delivery of the innings, a full one which crept under the bat, and the hosts were in dire trouble at 132 for five.
Sales said: "The aim at the start of the day was just to bat for as long as possible. Even though I was batting with the tail, I didn't want to take too many risks.
"They bowled well up front, but gradually a few bad balls came our way and we just tried to get a big score and grind them into the dirt.
"I was lucky to be dropped twice early on. I enjoyed every minute of getting my career-best score, but unfortunately ended up getting strangled down the leg side, which is never a good way to get out.
"We bowled really well when they batted again and have to continue that in the morning."
Day four at Cheltenham starts at 11am on Thursday.