Chronic pain can cause mental and emotional issues, and its complex nature can come between you and a good night’s sleep.