If you are feeling lonely in a dream it means that you feel abandoned by life. If you are lonely in the dream but not in the real world, you are disconnected from the world around you.
Where are you lonely? Are you lonely at home?
If you're lonely at home it means that deep down inside you feel that the outside world has forsaken you even if you're not particularly lonely on a regular basis. This may be a deep down emotional feeling that is unrecognized until the problem becomes insurmountable. However dreams allow us to intercept these feelings before they become so massive.
If you're lonely at a place that is crowded it means that you are disconnected from others, disconnected to their experiences, and you seek some kind of common ground.
The best solution for loneliness in the real world can be to busy one's mind with activities such as hobbies, games and goals. But loneliness in the dream world can be overcome by reminding yourself that you're not alone, because in truth you are not alone you just haven't found your tribe yet.
If you are lonely in the dream world and it triggers fear then one must learn how to challenge that fear by spending more time alone in the real world. By engaging with that fear, loneliness will no longer be associated with unpleasant dreams. You may even experience the byproduct of being more powerful when making decisions with whom you spend your time with.