If insomnia makes it hard for you to function during the day, see your doctor to determine what might be the cause of your sleep problem and how it can be treated. If your doctor thinks you could have a sleep disorder, you might be referred to a sleep center for special testing.