I recommend forcing yourself to socialize - even if it's not fun, it's better than the alternative. In my experience, being alone for too long with my own thoughts creates problems. I need outlets, people to talk to, I have a lot of questions that need sounding boards.
Oh and when I say "force yourself" I mean it. I saw a total stranger at a cafe, she was reading a book, I thought she looked harmless so I asked about the subject matter. We ended up chatting for about 10 minutes, it was nice, and we both moved on. But it was better than nothing - stuff like that can build your confidence. It might be hard to take that initiative, but when you say kind words, you will get kindness in response, I can guarantee that. Another tip is next time someone asks you to join them, do it, even if you feel like staying home that night. A lot of this loneliness we force on ourselves, yet we have a hard time seeing that.