After four successive failures, including a duck in the first innings of this match, the Delhi left-hander showed glimpses of his old self with a delightful knock at the County Ground.
He scored 106 from 149 balls, including 12 fours and a six, before he was bowled by Craig Miles.
He put on 201 runs for the opening wicket with Jaik Mickleburgh, who made 86.
This is Gambhir's first century in county cricket and 34th in his first-class career.
Essex declared their second innings on 285 for four after bad light halted proceedings, setting Gloucestershire 432 for victory.
Essex were 191 for no loss in their second innings at tea, with Gambhir batting on 100 off 144 balls, with 11 boundaries and a big six. He brought up his century off 141 from balls with a single off left-arm seamer David Payne.
The left-hander hit medium pacer Benny Howell for a boundary and a big six to move into the 90s. His footwork was assured from the start and he played new ball bowlers Payne and Will Gidman with ease.
He was prepared to wait for the loose balls but didn't lose out on opportunities to take a lot of singles and keep up the run-rate to boost Essex, who will are aiming for an outright win.
Why Indians walk away from county cricket...
Gambhir's lean patch continues
Gambhir scores 31 on county debut for Essex