Daniel Reilly, 36, pleaded guilty to having sex with a former student at his home in Forest Hills, Queens.
Police say Reilly carried on a more than nine-month affair with the girl that began when she was 14 years old.
Reilly will be on probation for 10 years and will be required to register as a sex offender.
The victim's family had contacted the school after the girl's sister saw sexually explicit text messages on her phone.
Reilly taught at Intermediate School 237 in Flushing.