The invention relates to a composition for treating and/or preventing snoring, comprising at least one thermogelling polymer that includes water-soluble units as well as units having a lower critical demixing temperature in water. Said composition has the specific feature of being liquid in the packaging thereof and becoming a gel upon contacting mucus membranes at 37° C. Thermogelling makes it possible to precisely target the area to be treated while avoiding any running or migration of the material, and makes the sprayed composition difficult to wash off, thus increasing the duration of the presence thereof in the treatment area.