I am so sorry you are having trouble sleeping and that these thoughts are making you so very upset and effecting how you are feeling. It is a hard time, being alone in the dark when you are left alone with your thoughts and memories that sometimes you want to forget forever.
There are some wonderful things you can do, that I am sure you know, but things like mindfulness exercises to relax your mind, some breathing techniques to help calm you. Things like essential oils like lavender that can put you into a really happy and relaxed state before you sleep. Even hot milk before bed, some soft music.
However I think though if you mentioned you are having thoughts about things that you would rather forget and that you are not able to manage that perhaps an appointment with a counsellor to help deal with some of these issues and put them to rest. The sooner that you can deal with these issues and stop them interfering with your life the better you will feel. You don't want these thoughts to manifest into other and more serious things.
Big hugs to you and I hope to chat to you some more.