Under the law, sponsored by Poland's centre-Right government, paedophiles convicted of raping children under the age of 15 years or a close relative would have to undergo chemical therapy on their release from prison.
"The purpose of this action is to improve the mental health of the convict, to lower his libido and thereby to reduce the risk of another crime being committed by the same person," the government said in a statement.
But the move drew criticism from human rights groups.
"Introducing any mandatory treatment raises doubts as such a requirement is never reasonable and life can always produce cases that lawmakers could never have even dreamt of," said Piotr Kladoczny from the Helsinki Foundation of Human Rights.
The law was approved by an overwhelming majority of 400 with one vote against and two abstentions in Poland's 460-seat lower house of parliament.
The bill, which also increases prison sentences for rape and incest, must still be approved by the upper chamber of parliament. But this is seen as a formality as Prime Minister Donald Tusk's Civic Platform party holds a majority of its 100 seats.
Mr Tusk first raised the controversial issue of chemical castration for convicted paedophiles in a year ago, after a 45-year-old man was charged with having raped and held his 21-year-old daughter captive for six years.
The young woman gave birth to two children, in 2005 and 2007, allegedly the result of having been raped by her father.
"I want ... to introduce in Poland the most rigorous law possible regarding criminals who rape children," Mr Tusk said at the time.
Seven hundred cases of paedophilia are reported to police in Poland each year, according to justice officials.
Poland's southern EU neighbour, the Czech Republic, has voluntary chemical and surgical castration laws in place for sex offenders.
Since 2000, around 300 Czech patients have undergone chemical castration, with around 94 undergoing the surgical removal of genitalia on a voluntary basis, according to Czech government statistics.