•High chronic pain stage associates with thinner prefrontal and whole brain cortex.•Sociodemographic groups differed in protective factors and clinical pain severity.•Chronic pain/brain relationships differed by sociodemographic groups.•Sociodemographic factors contribute to differences in pain-related brain structure.