I am constantly with music. Music in the headphones is played constantly, except for lessons at school. Maybe it's already my habit, but I can't sleep without headphones and my volume is decent 70-80% I'm getting enough sleep.
I sleep with music more than once, sleep is enough for 5-7 hours a day to get a good night's sleep.
It used to take more than 10 hours. What affects the reduction of sleep in favor of the body.
If this is not harmful, it is at least unpleasant. From my experience I can say that after such a dream it is impossible to stay awake, the effect is similar to insomnia: it is difficult to fall asleep, feelings become dull, a feeling of "weakness" in the morning.
There are some nuances, for example, special music for sleep, and if you set the volume to a low level, and put the music on for 20-30 minutes in time, so that in the later stages of sleep it does not interfere with the brain, then this may well bring calming and faster transition to sleep phase.
In addition to everything that Sergey wrote (and what is right), a person who listens to music while sleeping will also deteriorate his hearing. All human sensory systems have the property of "adaptation". This means that the system develops resistance to a constant (or periodically repeating), but not very uncomfortable stimulus. That is, if you listen to music 4 hours a day, hearing will suffer. If you stay in an overly lit room for a long time, your vision sensitivity will deteriorate. If every day you are slightly (but not strongly) asked by a neighbor with dumb questions, you will get used to it. Fortunately, the effect is reversible in most cases.
If we discard the likelihood of entanglement of headphones around the neck, which gives off fatalistic thrillers (although this happened, I heard it) and the much more likely possibility of breaking the headphones, then I think, yes, it is certainly harmful. I don't know how for the ears (if the volume is acceptable), but for the brain and the quality of sleep, this will definitely be a big, huge disadvantage. Human sleep is an extremely delicate thing; even a couple of glowing lights from a TV and a computer and the conversations of neighbors upstairs in the kitchen can affect its quality, even if you are sleeping safely and cannot see or hear them. In an amicable way, sleep hygiene implies maximum light isolation and the same maximum sound isolation, so a whole night with music in your ears will definitely not benefit your sleep, to put it mildly.