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.
The US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…