The largest chamber, the National Council, on Thursday approved the motion brought by centre-right politician Viola Amherd by a large majority.
The texting of home-produced intimate photos and videos by teenagers was a growing phenomenon in Switzerland, Amherd argued, according to news reports.
Clear rules were needed to stop the trend, which caused great suffering to victims, she said.
The parliamentarian said that pornography legislation was not adequate to cover sexting, which did not necessarily involve the sending of pornographic images.
Switzerland has in the past seen convictions related to the practice, with a man sentenced to four-and-a-half years in prison in 2014.
Justice Minister Simonetta Sommaruga argued that there was no need for a new legal provision, citing existing laws to protect the individual.
People whose image was distributed against their will suffered a violation of their personal rights whether or not they had taken the photo or video themselves.
It was important to raise young people’s awareness of the risks of the internet, the minister said, and to prevent intimate images being passed around.
The motion now passes to the Senate for debate.
Swiss youth advisory foundation Pro Juventute has been active in warning teenagers of the risks of sexting.
The organization’s media expert Laurent Sédano told the 20 Minuten newspaper that the answer to the problem was greater awareness and not a ban.