He will now go to prison immediately to serve the five-year term that he was given in March 2014.
It will be Mr Anwar's second spell in jail on charges which he has always argued have been politically motivated.
Mr Anwar is widely seen as the only man who can break the governing coalition's dominance, correspondents say.
"I maintain my innocence. This to me is a fabrication coming from a political conspiracy to stop my political career," Mr Anwar told the court.
He told the judges: "You have become partners in crime in the murder of judicial independence," prompting them to get up and walk out of the room, AP news agency reported.
Mr Anwar tweeted a statement later in the day, saying he would not be silenced.
His daughter Nurul Izzah Anwar, herself a politician, told the BBC that the opposition would hold a meeting on Tuesday evening to discuss "the next course of action".
She said she hoped her father's jailing would galvanise both the opposition and the electorate.
"I hope Malaysians will wake up... the only way to ensure normal... justice takes place is through the ballot box," she told the BBC World Service's Newsday programme.
In this most recent case, Mr Anwar was accused of having sex with a male political aide in 2008. Sodomy is illegal in Muslim-majority Malaysia, though very few people are ever prosecuted.
He was cleared by a High Court of the charges in 2012 because of a lack of evidence. The government then appealed and his acquittal was overturned. It is Mr Anwar's appeal against this ruling that has now been rejected.
The popular politician was previously imprisoned for six years for sodomy and corruption after being ousted as deputy prime minister in 1998.
He was freed in 2004 and went on to lead his three-party alliance to unprecedented gains in the 2008 and 2013 elections. In the latter, the ruling Barisan Nasional, which has been in power since 1957, suffered its worst-ever result.
Reading the verdict, Judge Arifin Zakat said there was "overwhelming evidence" against Mr Anwar and upheld the conviction.
The court subsequently reaffirmed the five-year jail sentence, as a few hundred of Mr Anwar's supporters protested outside.
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."
At the scene: Jonathan Head, BBC News, Putrajaya
There were tears and hugs for the Malaysian opposition leader from his family after his conviction was confirmed by the Federal Court. He had half expected this verdict, but, at the age of 67, has been dreading it too.
For 16 years Anwar Ibrahim has dominated Malaysian opposition politics, and for almost as long he has been fighting the same judicial battle against charges he and most human rights groups have always said were politically-motivated.
He is the first opposition leader to pose a serious challenge to the governing party's hold on power, using his own charisma and negotiating skills to bring three very different parties into a coalition which managed to win the popular vote at the last election, although not a majority of parliamentary seats.
Mr Anwar must now serve a five-year jail sentence and a five-year ban from office. It will be hard for him to bounce back again, and hard for the opposition Pakatan coalition to hold together without him.
But it will be just as hard for the government to reverse its flagging popularity, after a verdict many Malaysians will see as a cynical manoeuvre to remove a man it has long seen as its principal threat. Riven by factional infighting and tainted by corruption allegations, the government's problems are not solved by putting Anwar Ibrahim behind bars once again.
Human Rights Watch accused Prime Minister Najib Razak's government of persisting with a "politically motivated prosecution" of Mr Anwar.
"Allowing this travesty of justice to stand will further undermine respect for rights and democracy in Malaysia," said the group's Asia director Phil Robertson.
In an emailed 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."
Malaysia's top court has upheld opposition leader Anwar Ibrahim's conviction for sodomy after rejecting his appeal.