If you are prescribed diuretic tablets for high blood pressure or heart failure, try to have your last one by 4pm to avoid needing the loo during the night. Diuretic pills make you urinate more so take the pill in the morning and any second dose by mid afternoon as the effect can last for six hours.
Decongestant tablets and liquids for colds and sinusitis can act as stimulants too so avoid after 4pm or they can keep you awake. Nasal sprays however have less of a stimulant effect.