From your description it may be acting as a placebo -- the act of putting the pill into your mouth is what tells your subconscious to activate a sleep cycle.

Placebos are actually very effective for improving sleep

If you call it a ritual instead of a placebo it suddenly sounds much more credible.

Don’t jinx it

placebo works whether you believe or not and even if you know.

They are very powerful.