Melatonin is a helpful sleepaid and can be bought at grocery stores, pharmacies and supplement stores. The synthetic melatonin mimics the molecular make up of melatonin.
Leave him, leave her behind. Flush them from your thoughts. When you get upset at him/her.. send them blessings. It helps you heal, relieves your hurt, lets you move on.
When I first started doing that (and it seemed very foreign) I'd wish him helpful things, like a herd of camels. The simpler my blessing for him were, the better I felt. It's more for you, to help you heal.
Another technique is my mom's prayer, "Come Holy Spirit." which you repeat as many times as you need. I'd scoffed and avoided that one, but each time I've used it, I've felt better and able to handle difficult situations with calm.
Being offline is a good thing. Taking care of yourself is a good thing. Smiling, laughing, being grateful, allowing joy are all good things.