If you have difficulty sleeping, it is essential to determine whether an underlying disease or condition is causing the problem. Sometimes insomnia is caused by pain, digestive problems or a sleep disorder. Insomnia may also signal depression or anxiety. Often times, insomnia exacerbates the underlying condition by leaving the patient fatigued and less able to cope and think clearly. For insomnia related to a medical condition or pain, ask your doctor about nighttime pain aids.