Volunteering has several things going for it, though:
1) There is something other than simply socialization going on, which means there isn't the same pressure to be "on" and hold up your end of a conversation.
2) There is a built in topic of conversation (whatever you're volunteering for).
3) You will often see the same group of people repeatedly, which breeds familiarity and allows relationships to develop slowly over repeated interactions.
It also has to be the right other people. When someone says they're lonely, what I hear is a lack of connection to peers and others like them. I'm not sure how generic volunteering would help with that.
Not disagreeing but I have a little different experience. I volunteered in a radio program for about 5 years, it was about children's rights (not in the US) and every week we discussed a children rights violation in this country, go there, listen to the children's voices and discuss the issue with them. My co-volunteers were really great people. But somehow I never not felt not-lonely. Even though we were working for the same goal and we were socializing just fine, they didn't feel like the right people.
The most I ever felt non-lonely is back in college struggling through very challenging problem sets with my study group. It definitely felt like a have a "friend group" who shared something very important with me, and I miss those days a lot. Even to this day, when I'm given a hard task at work, I like solving it with my coworkers.
I think that generic volunteering might even make a person feeling worse, if they don't fit in with the organization.
All organizations have a culture.
Be strategic. Start with Meetup, find a couple of things that interest you and align with your work. Then find a role for yourself, a project that has specific outcomes and that you contribute to specifically. Have a cut off date where you either join something else, or move up in your role.
Or, go on a completely different tack and take up drumming in a drumming circle.
The point of recommending volunteering is that the group you're volunteering with provides the people. It's much easier to become one more in a pre-existing group than is to create an entirely new one from scratch.