The new bill retains most of the harshest measures of the legislation adopted in March, which drew condemnation from the United States, European Union, United Nations and major corporations.
The provisions retained in the new bill allow for the death penalty in cases of so-called "aggravated homosexuality", a term the government uses to describe actions including having gay sex when HIV-positive.
It allows a 20-year sentence for promoting homosexuality, which activists say could criminalise any advocacy for the rights of lesbian, gay, bisexual, transgender and queer citizens.
The legislation now heads back to President Yoweri Museveni, who can sign it, veto it or return it again to parliament.
Museveni, a vocal opponent of LGBTQ rights, has signalled he intends to sign the legislation once certain changes are made, including the addition of measures to "rehabilitate" gay people.
It was not immediately clear if the new bill satisfied his requests, and his office was not available for comment.
The legislation was amended to stipulate that merely identifying as LGBTQ is not a crime. It also revised a measure that obliged people to report homosexual activity to only require reporting when a child is involved.
Human rights activist Adrian Jjuuko dismissed the first amendment regarding LGBTQ identification as "useless".
"In practice, the police doesn't care about whether you've committed the act or not. They will arrest you for acting like gay, walking like gay," he said.
Same-sex relations are already illegal in Uganda under a British colonial-era law. LGBTQ individuals routinely face arrest and harassment by law enforcement, and passage of the bill in March unleashed a wave of arrests, evictions and mob attacks, members of the community say.
Proponents of the bill say broad legislation is needed to counter what they allege, without evidence, are efforts by LGBTQ Ugandans to recruit children into homosexuality.
After a voice vote on Tuesday that followed less than a half-hour of debate, parliament speaker Anita Among urged lawmakers to remain defiant in the face of international criticism.
"Let's protect Ugandans, let's protect our values, our virtues," Among said. "The Western world will not come and rule Uganda."
Western governments suspended aid, imposed visa restrictions and curtailed security cooperation in response to another anti-LGBTQ law Museveni signed in 2014. That law was nullified within months by a domestic court on procedural grounds.
The US government said last week that it was assessing the implications of the looming law for activities in Uganda under its flagship HIV/AIDS programme.
Reuters, the news and media division of Thomson Reuters, is the world's largest multimedia news provider, reaching billions of people worldwide every day.Go to: https://www.reuters.com/