How long can chlamydia and herpes stay dormant inside?

Lifetime. Chlamydia can be eradicated with antibiotics. Once you have herpes you have provided it with a permanent home.