Approximately 50% to 60% of all pregnant women suffer from insomnia during pregnancy. Pregnancy-related insomnia has been associated with severe outcomes for both mother and child postnatally. Currently, the treatment of pregnancy-related insomnia is often neglected due to a lack of suitable treatments. This online assessor-masked randomized controlled trial aimed to evaluate the effectiveness of music listening and sleep hygiene for treating pregnancy-related insomnia. We recruited first-time pregnant women at the end of the second trimester with a report of poor sleep. Participants in the music and sleep hygiene (MSH) group received standard sleep hygiene advice and were instructed to listen to music daily at bedtime for 4 weeks. They could choose from 6 sleep playlists of different genres. Participants randomized to the sleep hygiene alone (SH) group received standard sleep hygiene only. Primary outcomes were sleep quality measured with the Pittsburgh Sleep Quality Index (PSQI) and insomnia severity measured with the Insomnia Severity Index. gov Identifier: NCT04633395. Among the 98 participants receiving the online intervention, 31 participants in the MSH group (62%) and 40 participants in the SH group (80%) completed the postintervention measurements. Both groups experienced improved sleep quality during the intervention period (PSQI change, -2.10; 95% CI, -3.27 to -0.93; P <.001), with no significant difference between the groups. Similarly, insomnia symptoms were reduced (Insomnia Severity Index change, -3.42; 95% CI, -5.02 to -1.83; P <.001) with no significant difference in the effect between groups. There was a significant difference in adherence to sleep hygiene between the MSH and SH groups (42% vs 8%; P =.007). Sleep quality and insomnia severity can be improved in pregnant women with relatively simple interventions like music listening and sleep hygiene advice. These results align with previous research, but larger trials are recommended to support introduction into clinical practice.