Sixty participants with insomnia secondary to chronic pain were assigned randomly to either a cognitive-behavioral therapy (CBT) or a self-monitoring/waiting-list control condition. The therapy consisted of a multicomponent 7-week group intervention aimed at promoting good sleep habits, teaching relaxation skills, and changing negative thoughts about sleep. Treated participants were significantly more improved than control participants on self-report measures of sleep onset latency, wake time after sleep onset, sleep efficiency, and sleep quality, and they showed less motor activity in ambulatory recordings of nocturnal movement. At a 3-month follow-up assessment, treated participants showed good maintenance of most therapeutic gains. These results provide the 1st evidence from a randomized controlled trial that CBT is an effective treatment for insomnia that is secondary to chronically painful medical conditions.