There is a difference between being alone and feeling lonely. It is possible to feel lonely in a crowd or in a group of friends. Loneliness is something which comes from within, and overwhelms us when we are down or not coping. Being alone is altogether different. You can go camping with your dog. You can go to an exhibition in a gallery. You can go for a long walk by yourself and just examine your own thoughts. It is important to be able to extract meaning from the things around you, so that when you are alone you can call on your experiences and not feel lonely. What sort of things work for you? Listening to music is one, doing some drawing or painting is another - you need to try to immerse yourself in things which give you passion so that you can actually enjoy your own company.
Look at the glories of nature all around you, the petals of a flower or the flow of a creek. You can incorporate all these things within you so that you never need to feel onely, you have your own secret world.
When you are feeling better I have no doubt that the feelings of aloneless will leave you alone. Do what you can in the meantime to fill your inner life and find some companionship there. It does help, I have done it myself, and have managed to drag myself out of total misery to being back in the world again. I wish you good luck,
Ellu