Porifera primarily use chemicals to protect themselves, and the chemicals are either toxic or just taste bad. This not only prevents predation but also competition, as the chemicals they release prevent other organisms from growing near them. Individual species have other strategies, such as burrowing into corals, rocks or molluscs to gain protection.
Another strategy many corals use to keep predators such as sea stars away is shedding tiny bits of their skeletal elements, called spicules, onto the sea floor. These can accumulate in a thick layer, deterring predators that must crawl to reach them. Not all sponges have a direct defense mechanism. Glass sponges do not produce any toxins, but they live in the very deep ocean where predators are rare.