Sleep is a physiological function essential for survival, recovery, tissue repair, memory consolidation, and brain function. Pain is also an indispensable aspect of human life. The coexistence of sleep disorders and pain is often described in the literature, yet it is critical to define sleep not only subjectively but also using objective instrumental methods, such as polysomnography, that provide data on sleep quality. The aim of the study was to determine the relationship between orofacial pain (OFP), headache (HA) and sleep quality using subjective and objective sleep quality assessment methods. Additionally, we aimed to explore whether poor sleep quality was related to OFP and HA alone or was influenced by the coexistence of psycho-emotional factors such as depression, anxiety and stress. A single-night video-polysomnography was performed on patients from the Outpatient Clinic for Temporomandibular Disorders at Wroclaw Medical University, Poland, who had been diagnosed with OFP and HA. Additionally, questionnaires were employed to assess sleep quality, pain, HA, and the psycho-emotional state. There was no statistically significant relationship between the severity of OFP and HA and polysomnographic sleep quality parameters. On the other hand, the quality of sleep as determined by questionnaire studies correlated markedly with the severity of experienced pain. The severity of pain was found to be significantly correlated with depression, anxiety and perceived stress scores. The psycho-emotional aspects are of critical importance in the perception of OFP and HA. They can be associated with worsened subjective sleep quality, insomnia or daytime sleepiness. Therefore, the treatment of such patients must be preceded by a comprehensive assessment of their psychoemotional state, as anxiety, stress and depression can significantly influence the course of the disease and the response to treatment procedures.