While some over-the-counter antihistamines can cause drowsiness, routinely using them to treat insomnia isn't recommended.
Antihistamines, mainly used to treat symptoms of hay fever or other allergies, can induce drowsiness by working against a chemical produced by the central nervous system (histamine). These medications can be useful in certain situations, such as for treating sleeplessness related to travel.
However, tolerance to the sedative effects of antihistamines can develop quickly. As a result, the longer you take them, the less likely they are to make you sleepy. Side effects might include daytime drowsiness, dry mouth and dizziness.
Also, the sedating antihistamines diphenhydramine and doxylamine have anticholinergic properties that make them poor choices for older adults. Research suggests that anticholinergics might increase the risk of dementia. In older adults these drugs also can cause confusion, hallucinations, dry mouth, blurred vision, constipation, nausea, impaired sweating, inability to empty the bladder completely (urinary retention) and rapid heart rate (tachycardia).
Diphenhydramine and doxylamine also aren't recommended for people who have closed-angle glaucoma, asthma, chronic obstructive pulmonary disease or severe liver disease.
If you're struggling with chronic insomnia, don't rely on antihistamines for a good night's sleep.