The objective of this study was to assess the association between psychosocial factors (in terms of anxiety, somatization, depression, and optimism) and pain (in terms of headache pain intensity and pain-related disability), in patients with a painful temporomandibular disorder (TMD) and one of the following headache types: migraine, tension-type headache (TTH), or headache attributed to TMD, corrected for the influence of bruxism. A retrospective study was conducted at an orofacial pain and dysfunction (OPD) clinic. Inclusion criteria were painful TMD, with migraine, TTH, and/or headache attributed to TMD. Linear regressions were performed to assess the influence of psychosocial variables on pain intensity and on pain-related disability, stratified per headache type. The regression models were corrected for bruxism and the presence of multiple headache types. A total of 323 patients (61% female; mean age 42.9, SD 14.4 years) were included. Headache pain intensity only had significant associations in TMD-pain patients with headache attributed to TMD, and anxiety showed the strongest relation (β = 0.353) with pain intensity. Pain-related disability was most strongly associated with depression in TMD-pain patients with TTH (β = 0.444), and with somatization in patients with headache attributed to TMD (β = 0.399). In conclusion, the influence of psychosocial factors on headache pain intensity and pain-related disability depends on the headache type presenting.