I think what's helped me a lot are teachings by Ajahn Brahm on YouTube that touch on loneliness and how to be at peace with oneself. I've learned that I'm always with a friend - myself. Learning to be friends with oneself also helps one be friends with others for example by being generally happier and much less critical.