The measure backed by the House of Representatives also makes it illegal to form gay groups or organisations.
The bill - which was adopted by the Senate in 2011 - is now expected to be sent to President Goodluck Jonathan to be signed into law.
It is already illegal to have gay sex in Nigeria, and homosexuals say they often suffer abuse.
The proposed bill also envisages prison sentences up to 10 years for anyone who participates in gay clubs or organisations.
A number of other African nations have already made homosexuality punishable by jail sentences.
Nigerian lawmakers have approved a bill banning same-sex marriage, setting jail terms of up to 14 years for offenders.