So, some of the ways to help you fall asleep and stay asleep include practicing good sleep hygiene. This includes keeping your room a cool, dark environment. Cooling the temperature in your bedroom can help you lower your own body temperature, which will help with sleep onset. Avoidance of electronics, starting an hour prior to bedtime, can also diminish light exposure, which will help with your melatonin secretion. Melatonin is a hormone that your brain naturally secretes when it's closer to bedtime to help with sleep onset.
Some of the things that you want to avoid during bedtime or prior to bedtime are caffeine. Avoidance of caffeine should start about six hours prior to your bedtime. So, caffeine is a substance that can fight chemicals in your brain that help induce sleep and help maintain deep levels of sleep. Now, you also want to avoid alcohol starting two to three hours prior to your bedtime. Because alcohol will help you feel sleepy, but it will induce fragmented sleep in the second half of the night.
Now, medications can help you stay asleep and fall asleep a little bit easier. But maximizing on the first two options will help you get a better sleep rather than the use of medication.
Another way is to help you get a better night's sleep is to help maintain the health problems that you have that might be causing fragmentation of your sleep. An example of this is arthritis or other pain syndromes. If you don't have good control of your pain, pain could be waking you up in the middle of the night. Taking better control of these health problems can help you sleep better.