Engaging with social media before going to sleep has become a common habit that may negatively affect sleep quality, especially among pregnant women who are more susceptible to sleep disturbances due to the physical and psychological changes they experience. This study aims to examine the effect of nighttime social media use on sleep quality among pregnant women in Surabaya, while also identifying the specific sleep components most affected. A total of 147 pregnant women (N = 147) in Surabaya participated in this quantitative cross-sectional study, with participant selection conducted through purposive sampling. Information was obtained by administering an online survey consisting of the Nighttime-Specific Social Media Use Scale (NSSMUS) and the Pittsburgh Sleep Quality Index (PSQI). Statistical analyses were performed using simple linear regression and Spearman’s rho correlation to examine the seven components of the PSQI. The results showed that 95.9% of respondents (n = 141) experienced poor sleep quality (M = 11.47; SD = 3.40). The simple linear regression test demonstrated that nighttime social media use has a positive and significant effect on the overall sleep quality score (F(1, 145) = 16.89; p < 0.001; R² = 0.104; B = 0.179; t = 4.109), accounting for 10.4% of the variance; thus, the higher the social media use before bedtime, the poorer the sleep quality of pregnant women. Further analysis revealed the strongest correlations with prolonged sleep latency (ρ = 0.360; p < 0.001), daytime dysfunction (ρ = 0.342; p < 0.001), and nighttime sleep disturbances (ρ = 0.329; p < 0.001).