I believe my loneliness is mostly due to lack of close friends nearby and lack of fun activities. During my 20s, I had roommates and a larger social network and did not feel lonely. (They have either moved away, busy with family, or we have lost touch). Nowadays, I may go several weeks now where my only social activity is church. While I have several close friends nearby, we do not meet often or do not do fun activities. I meet up with one friend frequently, we meet for food but she doesn't like to go to the movies or shopping, etc. Similarly, with a couple of other friends we meet up for food. I do not have a group of friends from work (I am very close to the woman who sits next to me but we do not hang out after work). At church, I do have a couple of friends whom I mention here but most everyone is an acquaintance.
However, during this time, I believe I have drawn closer to God. However, I still have this sense of loneliness which I believe could be easily fixed if I had more close friends nearby.
While I love alone time especially during the weekdays after work, and some weekends, if I go multiple weeks without social activity except for church I feel lonely. It is also hard to be productive when I feel like this (laundry, cooking may get delayed, etc.).