Pain is underdetected and undertreated in people with dementia. We aimed to investigate the prevalence of pain in people with dementia admitted to general hospitals and explore the association between pain and behavioural and psychiatric symptoms of dementia (BPSD). We conducted a longitudinal cohort study of 230 people, aged above 70, with dementia and unplanned medical admissions to 2 UK hospitals. Participants were assessed at baseline and every 4 days for self-reported pain (yes/no question and FACES scale) and observed pain (Pain Assessment in Advanced Dementia scale [PAINAD]) at movement and at rest, for agitation (Cohen–Mansfield Agitating Inventory [CMAI]) and BPSD (Behavioural Pathology in Alzheimer Disease Scale [BEHAVE-AD]). On admission, 27% of participants self-reported pain rising to 39% on at least 1 occasion during admission. Half of them were able to complete the FACES scale, this proportion decreasing with more severe dementia. Using the PAINAD, 19% had pain at rest and 57% had pain on movement on at least 1 occasion (in 16%, this was persistent throughout the admission). In controlled analyses, pain was not associated with CMAI scores but was strongly associated with total BEHAVE-AD scores, both when pain was assessed on movement (β = 0.20, 95% confidence interval [CI] = 0.07-0.32, P = 0.002) and at rest (β = 0.41, 95% CI = 0.14-0.69, P = 0.003). The association was the strongest for aggression and anxiety. Pain was common in people with dementia admitted to the acute hospital and associated with BPSD. Improved pain management may reduce distressing behaviours and improve the quality of hospital care for people with dementia.