Malayasia (BBN)-Mr Anwar was accused of having sex with a male aide in 2008.
Sodomy is illegal in Muslim-majority Malaysia, but very few people are ever prosecuted.
The popular politician was sentenced to five years in jail in March 2014 after an earlier acquittal was overturned – a ruling against which he appealed, reports BBC.
He says the case is a bid by the ruling coalition to block him from politics.
Mr Anwar – who heads a three-party alliance – is widely seen as the only man who can break the governing coalition’s dominance, correspondents say.
The Barisan Nasional has been in power since 1957, but suffered its worst-ever result in the most recent elections in May 2013.
Reading the verdict, Judge Arifin Zakat said there was “overwhelming evidence” against Mr Anwar and upheld the conviction.
Sentencing will take place shortly.
Ahead of the verdict, Mr Anwar, 67, said there was “no reason whatsoever for them to ever consider putting me to jail”.
“I am innocent,” he said. “Now in the event there’s a political decision to put me in jail, I understand the system, I’ve served time in prison… But then this is a price I have to pay.”
In 2008, Mr Anwar was accused of having sex with a male political aide.
He was cleared by a High Court of the charges in 2012 because of a lack of evidence.
The government then appealed against his acquittal and it was overturned by the court.
It is Mr Anwar’s appeal against this ruling that has now been rejected.
This is the opposition leader’s second sodomy conviction since he was sacked from the Barisan Nasional government in 1998. His previous conviction, from 2000, was overturned.
Human Rights Watch condemned what it described as the “selective persecution” of Mr Anwar.
“PM Najib’s government wants to push him off the political process,” Reuters news agency quoted Phil Robertson, the group’s deputy director for Asia, as saying.
In a e-mailed statement, a Malaysian government spokesman said “exhaustive and comprehensive due process” had been followed.
“The judges will have reached their verdict only after considering all the evidence in a balanced and objective manner.”
TIMELINE: ANWAR IBRAHIM
1993 to 1998 – Deputy Prime Minister, under Prime Minister Mahathir bin Mohamad
1999 – Jailed for abuse of power, sparking huge street protests
2000 – Found guilty of sodomy with his wife’s driver
2004 – Supreme Court overturns sodomy conviction, freeing him from jail. He quickly emerges as the de facto opposition leader
March 2008 – ruling coalition narrowly wins general election, but with its worst results in 50 years. The opposition makes unprecedented gains
Aug 2008 – Anwar charged with sodomy for a second time, but despite this is soon voted in as an MP
Feb 2009 – Second trial for sodomy starts
Jan 2012 – Acquitted of sodomy by High Court
May 2013: Leads opposition to best-ever performance in general elections
Mar 2014: 2012 acquittal overturned by court after government appeal
Saturday, February 23, 2019