Kent 343 (Leaning 118, Khushi 53, Barker 4-85) and 132 for 2 (Compton 71*) trail Hampshire 505 for 8 dec by 30 runs
Leaning led the resolve in the first innings by returning from injury to score 118, before Compton bedded in with 71 not out in the second innings.
But their determination came with a backdrop of a 162-run first innings deficit, meaning Hampshire forced them to follow-on, and just eight wickets in hand heading into the final day.
The duo ended the day with a 84 unbroken partnership with Kent up to 132 for 2, with the deficit down to just 30 runs.
After James Vince’s swashbuckling 211 on day one, and a fast-paced day two, the third day never progressed from sedate. Leaning returned on 73, having guided the visitors around an unconvincing evening session which saw them end up six down and trailing by 299 runs.
He survived Vince dropping him at first slip on 84 but was otherwise restrained and oozed leadership in his fightback while marshalling the tail.
Leaning had missed the last seven weeks with a broken hand, which he suffered during the drawn match with Worcestershire in May.
In that innings he had scored an unbeaten 179 and he made it back-to-back hundreds in 207 balls, the 10th of his career, sixth since joining Kent and second in his last three visits at Utilita Bowl.
Around Leaning, two wickets fell on either side of the second new ball.
Charlie Stobo’s sensible 28 was ended two overs before the new ball was unveiled when James Fuller pinned him leg before. And then four balls into the new cherry, Grant Stewart was rapped on the pads by Mohammed Abbas.
But Matt Parkinson took more time out of the game with Leaning, and minimised the deficit with a no-thrills 24. The pair put on 44 to frustrate the hosts.
But Leaning’s majestic innings was ended when Kyle Abbott splayed his stumps and Kent were bowled out for 343 when Parkinson fended Keith Barker to first slip – Barker ending with 4 for 85.
The last four Kent wickets put on 137 to almost avoid the follow-on, but despite their efforts Vince was able to turn them back around.
Feroze Khushi was more restrained than during his thrilling first-innings 53, but fell for a short-ball trap to top edge Barker to long leg.
Daniel Bell-Drummond lasted slightly longer before Liam Dawson extracted enough turn to cannon into off-stump. But Compton found company with that man Leaning to take any sting out of the day.
Opener Compton reached fifty in 114 balls with a reverse sweep.
Leaning was dropped by Vince for the second time in the day but was otherwise solid to all but wipe out the deficit.
Hampshire will need eight wickets and likely a bit of a chase on the final day, and might be without Barker – who pulled up during a delivery midway through the evening and didn’t return.