During the trial, it was revealed he had raped the children -- many from poor families attending the school on scholarships -- over five years.
Prosecutors requested chemical castration and the death penalty for the accused, who asked the judge for leniency to allow him to raise his children.
Wirawan arrived in court in handcuffs and kept his head down as judge Yohannes Purnomo Suryo Adi sentenced him to life in prison. The court said restitution for the victims will be paid by the government.
The chairman of Indonesia's Child Protection Commission said Tuesday's verdict meant "justice for the victims has been served".
'There will be more'
But a family member of one of the victims told AFP he was "very disappointed" that Wirawan did not receive a harsher sentence and warned that leniency would embolden other abusers.
"This wound will never be healed as long as we live, maybe until we die. The pain we are feeling is indescribable. We don't feel heard," said Hidmat Dijaya, an uncle of one of the 13 victims.
"If the sentence is lenient like this, there will be more Islamic teachers who will abuse children," he added.
"We will let God as the highest judge punish him. We can only pray because those judges failed to represent our hurt and pain."
More than 25,000 Islamic boarding schools -- known as "pesantren" -- are dotted across Indonesia, with nearly five million students living and studying in the dorms.
Teaching is often regimented -- students attend regular classes during the day and continue Koranic studies and Islamic teachings into the evening.
The Bandung rape case has shone a spotlight on the problem of sexual abuse in some of the schools, with 14 out of the 18 cases reported to the Child Protection Commission last year taking place in pesantren.
Last year two teachers at a boarding school in South Sumatra were arrested for sexually abusing 26 male students over the course of a year.
And in 2020, a boarding school teacher in East Java was sentenced to 15 years in prison for sexually assaulting 15 female students.
President Widodo last month called on parliament to approve a bill on the "elimination of sexual violence", which seeks to combat sex crimes and provide justice to victims, including in cases of marital rape.
The bill was drafted in 2016 but has run into delays, with Islamic groups complaining it promoted promiscuity and conservative lawmakers calling for it to criminalise extramarital sex and LGBT relationships.