Snails can breathe using gills or primitive lungs.

An excerpt from the article 19 facts about snails

The vast majority of sea snails are equipped with gills, some freshwater snails also breathe with them. Other freshwater species and most terrestrial species use a primitive lung for breathing, composed of a mantle cavity with a strong blood supply.