The boy, who was recently traced to Tirupur where he and the teacher were working in a mill, was produced in the court in response to a habeas corpus petition filed by his mother.
A bench, comprising Justices A.Selvam and M Chockalingam, closed the petition after the boy opted to go with his mother when the judges asked him whether he wanted to go with his parents or live in a children's home.
On a complaint from the parents, police had registered a case of kidnap and sexual harassment against the teacher and arrested her last week.