Sleep is highly influenced by your habits and environment. Insomnia is tough to treat with medications because a person could end up dependent on taking the medicine to sleep at night, rather than really addressing the insomnia for its root cause (anxiety, depression or an environmental shift). To make sure you get into the habit of a good night's sleep, make sure you are setting yourself up for success.
The most important thing about getting good sleep is recognizing that we are all creatures of habit. Our bodies have their own alarm clocks and do best when they are on a schedule. Therefore, its important to sleep at the same time every night and wake up at the same time. This includes weekends. The average person needs 7-8 hours of sleep. Some need more and some can get away with less. You will know where you fall based on if you are able to focus and feel well rested the next day.
It's also important to create an environment connducive to sleep. Back in the day, before humans were exposed to LED and fluorescent lights all the time, the world would get dark and we just KNEW it was time for bed. Nowadays, we are on media until the last minute we go to sleep and many of us have our phones an arm's length away from our pillow. This can be confusing to our sleep-wake cycle for many reasons. It convinces us we still need to be awake. Furthermore, being on media could mean watching a scary movie, studying for a test or doing our taxes--all not-so-relaxing things we are doing before we go to bed. Our busy life styles are not allowing us to wind down and relax before we hit our pillows.
Ideally, the last 1-2 hours before you go to bed, you should develop a ritual that cues your body that you are going to sleep. This can be individualized, it can be yoga, a bath, reading a book (not on a tech device) or meditation. What is important is it is relaxing and quieting your mind, rather than stimulating it. If you know you are going to lie in your bed, worrying about what happened that day or what will happen tomorrow, make sure you definitely spend at least a while out of bed unwinding your mind. Perhaps this means scheduling some exercise in the day to compartamentalize your anxiety, then meditating later that night. I am also a big fan of apps that have sounds of the ocean, rain or any kind of white noise to lull you to sleep (keep it face down near your bed so your room is completely dark).
Here are some other tips:
1. Use the bed for sleep only. It is not a desk for homework or a place to be when you can't sleep!
2. Make sure the environment is cool and as dark as you can make it.
3. Do not look at media 2 hours before bed. Phone screens can stimulate your brain to be awake.
4. Do not drink caffeine past noon. This includes sodas and teas.
5. If you wake up or can't sleep, get up out of bed. Do something boring then when you get sleepy, get back in bed. This way your body learns to associate the bed with sleep only and being out of bed with activity.
6. Add exercise to your schedule but don't exercise 2 hours before sleeping. This tip can be especially helpful for people with anxiety.
7. Avoid naps in the daytime.
8. Drink some chamomile tea, sleepy time tea or noncaffeinated tea (roobios or white teas are non caffeinated and green teas and black teas like chai are caffeinated). Oh, and make sure you go to the bathroom before bed so you don't have to get up.
9. If you are cold, make sure your feet are warm and you have enough blankets.
10. Stay away from alcohol and other drugs. Alcohol disrupts your sleep cycle. It make you feel relaxed to get you to bed initially but it actually messes up your sleep architecture in the long run. Not to mention, you develop a dependence to it.
11. Keep a sleep diary you can show your doctor to help you track the problem and take charge of your sleep.