A charge was registered against the parents of the boy for keeping the child confined in inhuman conditions.
The parents run a shop and would often leave the boy locked in the apartment for hours at a stretch, it was claimed.
The locals said the child would often stare out of the window. The neighbours informed Childline (a non-government organisation that works for child rights in India) about the situation.
According to reports, when officials from the organisation visited the house they found the boy sitting by the window with dogs. When the officials visited the house again on Monday, they found the boy locked in with the dogs.
"We got information from the childline official that this boy is locked up in a very inhuman way inside the house. She tried to make the parents understand to send him to school but they wouldn't listen," a child welfare committee official told The Independent.
The official added: "The official with the help of local police broke the door and rescued the child. The boy was kept with the dogs for two years and he was taken out of school because he started picking up their behavioural traits. He tried to bite someone in school. We will take strict action against the parents."
Police officer Sardar Patil told reporters that the parents are likely to be arrested and produced before a court. "The boy after being rescued from the small apartment was sent to a childcare centre and further action will be taken as per the directions of the CWC," Mr Patil added.
"We also found four dog carcasses there. Even animal excreta were not removed from the apartment. The boy was kept in very dirty conditions," Anuradha Sahasrabudhe, executive director of Dnyana Devi Childline, told The Indian Express.
"We have, therefore, urged the police to give him proper treatment as well as counselling and follow the directions of the CWC," she added.