The boy along with his father came to a shop when he fell into the pit with sewage in Velachery, they said.
Oxygen was supplied into the pit and the boy was rescued in an hour-long operation.
He was rushed to a private hospital where doctors said he was out of danger after treatment.
Initial investigations revealed that the pit was not closed properly, police said, adding a case has been registered against the shop owner for 'negligence'.