The Buddha tells us, quite plainly, that it is suffering to be separated from those we love. Indeed.
The Buddha also tells us that friendship with what is wholesome is the whole of the Holy Life.
If we put these two statements together then we see that the spiritual solution to our loneliness is to abide with that part of ourselves which is wholesome and to remember and to recollect the part of our loved ones that is the same. Looking deeper we can also realise how stable the wholesome aspects of our mind can be. When we meet a good friend after very many years we can still connect with their good side as though we have never been apart. So this solution is not as difficult as it might look.
Just as with boredom it is a matter of giving something to our loneliness rather than falling prey to the craving that is its unwholesome side.
Such love, a giving love and a love of giving, is the solution to our loneliness.
Practising like this I have spent months alone and silent and never felt lonely. Only the craving feels lonely.
I offer this for your reflection