I have done a simple practice for many years that alleviates all kinds of suffering, loneliness being just one common kind. It's described well in this book: https://library.dhammasukha.org/uploads/1/2/8/6/12865490/the...
The basic idea is this. You have to train the mind, a bit like how you'd train a puppy, except of course that you have a lot more material that needs to be configured, so it requires more patience. When the mind comes and disturbs you about something (usually with the intent to help you be a successful animal), you do some very simple steps to soothe the mind about that issue and reduce the likelihood of the mind bothering you about that again. In this way, you gradually get more and more peace and happiness that seems to come out of you, not in dependence on worldly circumstances.
May you be well, happy, and peaceful.