In short, yes, ear plugs are safe to sleep in, but it's important to take some precautions to guarantee your safety and comfort.
Disposable foam earplugs are commonly used for sleeping and can help block out noise that may interfere with sleep. They are generally safe to use as long as they are inserted and fitted correctly to avoid any discomfort or injury to the ear canal. It's also important to use a fresh pair of earplugs each night and dispose of them properly to prevent the risk of infection.
Reusable sleeping ear plugs such as the Alpine Sleepsoft or Alpine SleepDeep may be better options for those who regularly wish to use ear plugs for sleeping. They're designed to be comfortable for overnight wear. They also block slightly less sound than foam ear plugs, which will ensure you are still able to hear your alarm clock in the morning or emergency alerts such as a smoke detector or fire alarm.
Silicone putty ear plugs provide great comfort but still allow enough sound to pass through the ear canal to hear important alerts. One benefit of silicone putty over other ear plugs over other types of ear plugs for sleeping is they form a seal over the ear canal as opposed to inside it. This is great for anyone with sensitive ears or prone to ear infections.