Human Rights Watch decried what it called Anwar's "selective persecution".
Prime Minister Najib Razak's government has rejected any suggestion of interference in the case.
"Malaysia has an independent judiciary, and there have been many rulings against senior government figures," a government statement, issued after the ruling, said.
"The police report against Anwar Ibrahim was brought by a private individual - Anwar's employee and personal assistant - not by the government."
Read MoreMore bad news for Malaysia: Downgrade looms
Anwar was accompanied by his wife and children in the courtroom.
In the mid-1990s, Anwar was the ruling UMNO party's rising star before he fell out with then premier Mahathir Mohamad.
He was sacked in 1998 and then campaigned against corruption and nepotism and led a nationwide "reformasi" (reform) protest movement.
Since then, the former deputy prime minister has been beset by legal problems and spent several years in prison after being convicted of corruption and an earlier sodomy charge.
But the charismatic Anwar, who heads a three-party opposition alliance, has remained the greatest threat to Malaysia's political establishment.
His lawyers appealed against a conviction last March of sodomizing a male political aide, and a sentence of five years in prison. Sodomy is illegal in Muslim-majority Malaysia.
Anwar denied the charge and said it was politically motivated.
Some ruling party members and analysts have played down fear of upheaval if the ruling goes against Anwar.
"Anwar's political image is not anywhere near close to what it was in the '90s," said Wan Saiful Wan Jan, of the Institute for Democracy and Economic Affairs. "The country has moved on."
Anwar's jailing could herald the disintegration of the three-party alliance he leads. It is paralyzedwith infighting and a meeting on Sunday to iron out differences and find a possible successor to Anwar was inconclusive.