The anti-gay bill also makes it a crime punishable by a prison sentence not to report gay people.
Uganda’s PM Amama Mbabazi opposed the vote, saying not enough MPs were present.
The bill has been condemned by world leaders since it was mooted in 2009 with President Barack Obama calling it “odious”.
The government knows there will be an international outcry, which could see some countries suspend aid to the country.
Amama Mbabazi might follow up on his complaints about a lack of quorum, while it remains to be seen whether President Yoweri Museveni will sign the bill into law.
The private member’s bill originally proposed the death penalty for some offences, such as if a minor was involved or the perpetrator was HIV-positive, but this has been replaced with life in prison.
The MP behind the bill, David Bahati, told the AFP news agency: “This is victory for Uganda. I am glad the parliament has voted against evil.”
“Because we are a God-fearing nation, we value life in a holistic way. It is because of those values that members of parliament passed this bill regardless of what the outside world thinks,” he said.
The bill’s supporters say it is needed to protect traditional family values, which they say are under attack from Western-inspired gay rights groups.
Its critics say the bill has been pushed by some US evangelical Christians.
Holidaymakers and visiting foreigners are not immune from prosecution under Uganda’s existing anti-gay laws.
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…
Misleading allegations, rumours and outright lies about voting and fraud are flooding online spaces in…
At least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…