I had many of the same feelings in grad school (I was done with classes about 5 years ago), and every now and then I still have that but not as much since I generally don't have time for a social life (with a full time job and two toddlers, I pretty much want to be alone whenever I get a chance!).
Anyway, for me I had some interesting issues in grad school. I dated a fellow grad student for 4 years, and then we broke up. When we dated we had a lot of the same friends and since I was in a relationship, I rarely felt lonely. But I felt really lonely after we broke up, when I was without that main relationship and also realized that most of our friends were really his friends. I had to do a lot of work on myself at that time. I was really depressed and was going through counseling. I remember saying something like "I just can't seem to make friends" and the counselor just said something like "You can't? Why not?" and it stopped me dead in my tracks. I realized that my inability to make friends was really due to me being afraid to try, being afraid of rejection.
So I started hanging out with a new grad student who lived near me, then the social group just started growing. We shared an interest in losing weight, and some of the other people would go to the university's rec center together. I started inviting people over to my apartment to watch Trading Spaces (back when it was good
. Honestly, it just started with me making a little effort with one person.
Sorry, I guess I could write a book. I think that it is common to feel this way. Grad school can be a good time to build friendships, but I honestly found it was a lot harder than in college, and friends of mine who worked right after college noticed the same thing. I really think it's common, so don't beat yourself up about it. But if there's someone you think you could be friends with, just try to get something planned. You never know!