Pregnancy- related anxiety is a risk factor for sleep quality, however, family functions are protective factors for sleep quality. Family functions play an intermediary role in sleep quality caused by pregnancy-related anxiety, especially on the third trimesters. This finding may provide a scientific basis for developing intervention strategies to improve the sleep quality of pregnant women.