Sanil K. James was convicted of raping and sexually assaulting the girl at a Salvation Army church in the southern state of Kerala in 2014.
The 37-year-old is also being investigated for the alleged rape of another girl during the same period.
“The court said the priest deserved the maximum punishment for this cruel act,” special prosecutor Pious Mathew told AFP.
Prosecutors told the court James had raped the girl, now aged 13, several times inside the church complex over a period of two months.
The judge ordered that he should not get remission and also imposed a 20,000 rupee ($295) fine.
He was given two 20-year sentences, one under India’s stringent Protection of Children from Sexual Offences act and one under a separate section of the criminal law covering the rape of children.
Activist Smriti Minocha said the length of the term was highly unusual in a country where even those sentenced to life usually only serve 14 years.
“Courts normally award life sentences to rape convicts but sentencing him to 40 years is exceptional,” said Minocha, director of the women’s justice initiative at the Human Rights Law Network, a Delhi-based NGO.
“Most of the cases of child sexual abuse remain undocumented, it’s only grave acts like rape and molestation which are reported.”
Child sexual abuse is common in homes, schools and residential care facilities across India and critics say the authorities have a poor record in bringing offenders to justice.
More than 18,000 children were sexually assaulted in 2014, according to India’s national crime records bureau.
A UN Committee on the Rights of the Child in 2014 said it was alarmed by widespread violence and sexual abuse of children in India.
It said one in three rape victims in India was a minor and half of the abusers were known to the child or in a position of trust and responsibility.