Section 377 of the penal code, a relic from 1860s British legislation, bans gay acts as "carnal intercourse against the order of nature" and allows for jail terms of up to life.
The Supreme Court began hearing petitions against the ban on Tuesday, in the latest twist in a legal tussle between social and religious conservatives and more liberal Indians.
Setting out New Delhi's position on Wednesday, senior government lawyer Tushar Mehta said Delhi would leave whether to decriminalize homosexuality "to the wisdom" of the court.
The court on its part also appeared to be in favor of overhauling the archaic law, according to the NDTV news network.
"We don't want a situation where two homosexuals enjoying a walk on Marine Drive (a Mumbai boulevard) should be disturbed by the police and charged under Section 377," Justice J. Chandrachud, who is a part of the bench hearing the matter, was quoted as saying by the channel.
The Delhi High Court effectively decriminalized gay sex in 2009, but the Supreme Court reinstated legal sanctions four years later after a successful appeal by religious groups.
The Indian government has offered mixed messages on the issue in the past, with some ministers speaking out in favor of Section 377, only to be contradicted by others.
Gay sex has long been taboo in conservative India - particularly in rural areas where nearly 70 percent of people live - and homophobia is widespread. Some still regard homosexuality as a mental illness.
According to official data, 2,187 cases under Section 377 were registered in 2016 under the category of "unnatural offenses." Seven people were convicted and 16 acquitted.
Globally 72 countries criminalize same-sex relationships, according to a 2017 report by the International Lesbian, Gay, Bisexual, Trans and Intersex Association.