There are several different types of sleeping pills, classified as sedative hypnotics. In general, these medications act by working on receptors in the brain to slow down the nervous system. Some medications are used more for inducing sleep, while others are used for staying asleep. Some last longer than others in your system (a longer half life), and some have a higher risk of becoming habit forming.
We cover here the main medicine categories in use to treat poor sleep: benzodiazepines, Z-drugs, antidepressants, melatonin and antihistamine/OTC (over the counter medicine). Z-drugs are the most common medical choice to treat short-term insomnia. They work in a similar way to benzodiazepines but don’t change the structure of sleep as much as benzodiazepines. Melatonin is typically used with older patients and when treating delayed sleep cycle. Benzodiazepines are no longer recommended as they are addictive and quickly lead to bigger doses. Small doses have gained a foothold as they increase deep sleep and can also have a positive effect on mild depression. Chlormethiazole, chloral, and barbiturates are old fashioned sleeping tablets. They are not commonly used these days as benzodiazepines and Z-drugs are usually preferred.
Non-medicine treatments are always preferred when treating long-term insomnia. The focus is then to identify and treat the causes of insomnia rather than the symptoms. Medicines (all of them) should perhaps be avoided altogether when treating long-term insomnia. Medicine can be beneficial when treating short-term poor sleep thus avoiding a longer-term problem.