Leach followed his unbeaten 82 from the first innings, which had been his best career score, with 103 not out as the visitors reached 296-8 to lead by 152.
He shared a fifth-wicket stand of 109 with Thilan Samaraweera in his innings which has so far lasted 234 minutes.
Leach survived a hard caught and bowled chance to Benny Howell on 91 before reaching his ton in the last over.
BBC Gloucestershire's Ian Randall :
"Advantage Gloucestershire after a long day in the field despite Joe Leach's maiden century.
"Openers Mitchell and Pardoe provided stoic resistance and Samaraweera looked well set when he was given out lbw to Will Gidman, but Leach gave only one difficult chance on 91 when Howell dropped a sharp catch off his own bowling.
"Four wickets with the second new ball left Graeme Cessford to keep Leach company until stumps.
"Worcestershire's lead is 152, but they probably need another 50 runs to give themselves something to bowl at and extend their run of Championship wins at Cheltenham to four in a row."
BBC Hereford & Worcester's Dave Bradley:
"Worcestershire showed some fight for the second day running, and the first session of the game looks as if it could still be the deciding factor.
"Leach's century was almost faultless and a young batsman who has worked at his game deserved his rewards.
"Worcestershire were a little peeved at one or two decisions, Samaraeewa's lbw looking doubtful, but credit to the Gloucestershire attack who stuck to the task on another boiling hot day.
"To get 200 in the last innings could be difficult."
Match scorecard
Joe Leach hit his maiden first-class century to give Worcestershire some hope against Gloucestershire.