The visitors had slumped to 69-4 in reply to Gloucestershire's 383 all out at Cheltenham, before Cox and George Rhodes (52) shared a stand of 141.
Cox eventually nicked medium-pacer Kieran Noema-Barnett (4-31) behind and Worcestershire declared on 300-9.
The hosts batted out eight overs to close on 20-0, leading by 103.
In the morning session Gloucestershire added 40 to their overnight first-innings score of 343-8, with Jack Taylor last man out for 143.
Gloucestershire captain Phil Mustard told BBC Radio Bristol:
"Our bowling at the start of Worcestershire's innings was fantastic. There was enough in the wicket for the seamers and they used the new ball really well.
"As in our innings, after 35 overs, the ball went a bit soft and didn't do as much. That was always going to be the case, but the boys stuck to their guns and tried to hit the right areas.
"Hats off to Kieran Noema-Barnett for his four wickets. I love having a bowler like him in my team. He swings it, nips it around a bit and can tie up an end for you."
Worcestershire centurion Ben Cox told BBC Hereford & Worcester:
"It was good fun. I enjoy those situations when you go into bat with the team struggling a bit. It seems to bring out the best in me and makes me give than 10 per cent more.
"It wasn't too pretty to start with because it was one of those pitches where it was hard to get your timing in the first 30 balls or so.
"But it's a monkey off my back because it is two years since my last hundred and I have been working really hard at spending more time at the crease."
A career-best 124 from wicketkeeper Ben Cox helped Worcestershire recover from a precarious position on day two against Gloucestershire.