Hi Spook. I'm sorry you had such a bad night. Unfortunately that is the worst time when you are broken-hearted. What has happened to you is devastating and it will take time to get over it. But you will do and you will become richer along the way.
Changing the locks against your husband seems like drastic action, I know, but it was the right thing to do. He has chosen to make his home elsewhere and if he feels he can walk in and out whenever he likes it is going to mess up your head. You surely have the right to a little privacy to help you heal. If your marriage is mended you will give him a key, it's a very easy thing. For now it is certainly best that he is made to realise that his actions have consequences.
Whilst I would not want to spend nights as you are doing, those awful lonely and sad times are all part of the healing process. I would be more worried if you didn't experience that awfulness, because it would be an indication that you were unable to face the pain, and an early sign that you might break down or suffer some kind of illness. If you can bear to go through those nights you will work through everything and come out the other side as sweet and loving a person as you went in.
Perhaps thinking about that will help. Focus on the new you that will emerge, in time from the other side of this dark cloud, someone who has admirably faced this time of trouble and allowed it to teach her and strengthen her.
Try to do something nice for yourself every day that would not be possible if h were still around. Do something you enjoy that he wouldn't want going on. Gradually you will find things to like and look forward to in your freedom and they will give you relief from your misery.
I wish I were nearer, I would be straight round with a large chocolate cake and a few bottles of wine. It's only a band-aid on a big wound, but these little things count in the end.