So, there are many different ways to treat insomnia. The first step is to improve your sleep hygiene and sleep habits at night. Taking a warm bath will help you drop your body temperature, which initiates sleep onset. Sleeping in a cool, dark environment will also help with the sleep onset and help with melatonin production. Keeping a strict sleep schedule will help you train your body and set your circadian rhythm to feel sleepy at a certain time. That is the first step in treating insomnia.
Now, if that isn't working, then you might have to move on to the use of medications. You have different medications that will help you treat insomnia, such as benzodiazepines, which work on a neurotransmitter called GABA, which helps promote sleep. Now, these are commonly known as Valium and Ativan or Xanax. Other medications include benzodiazepine receptor agonists, which also work on that neurotransmitter, but have a lesser of side effect than benzodiazepines. These are commonly known as Ambien or Lunesta. Some anti-depressants do have a side effect of insomnia and are commonly used when your insomnia is due to depression or anxiety.
You do have behavioral therapies, such as cognitive behavioral therapy, which is used to treat insomnia. This includes changing your beliefs and your behaviors and patterns that are perpetuating your insomnia, as well as the use of sleep restriction, which decreases your time in bed. So you're using sleep deprivation to help you get a more consolidated, better quality sleep. So, to treat your insomnia, you should really discuss with your physician what kind of therapy would be best suited for you.