Honestly I preferred boars. They were just friendlier. We had a few who lived in pairs happily but a few who could not - but we put this down largely to the presence of females also being in the house and the boys being able to smell them. The trouble us you don't know how it's going to work out when you get them!!
We used to keep them in cages with a side open as they would stay in their space but we're more part of the family. One of the boys was a little adventurer. He'd frequently get out of his cage and go and say hello to one of the more docile males. Then wander back to his space. It worked well for both of them as they had company but also had their own territory. We noticed that boys always need their own sleeping quarters and don't tend to like to share beds.
We also had a boy who lived with a girl whom we had neutered. It wasn't something we did lightly and is generally isn't recommended as small animals and anesthesic are not a good combo and it's high risk. He was having various problems in that department and it helped the situation. They were wonderful together and brought the best out of each other.
Groups of three can work, but in all honesty if you are going to do that, you can't have three boys. We never managed more than a pair of boys living together without completions.
It's a recipe for disaster. It's either three females or one neutered male and two females.
The girls almost always sleep in the same house and were a lot more anxious, and therefore not quite as good as pets as the males IMHO.
If you want friendly Guinea pigs, then handling them as much as possible and having them the house not down the bottom of the shed is much better (plus Guinea pigs are very much like humans in the temperature range they do well in. Being outside in winter is not good for their health). We've had rescue pigs, pigs from a shop and bred our own and it's true of all of them; they like company and like to watch you. (having them in a child's bedroom where they never see people isn't ideal either, plus they are most active first thing in the morning or at bedtime).
I don't think there is really an answer to 'which is better, male or female', just which has the least problems and is better suited to your circumstances.
Just be aware whilst the average life span is supposed to be 3 years, several of ours who lived in the house (which they all should for their welfare), lived until they were 7. That's one of the reasons we decided not to get any more as much as we absolutely loved having the critters around (we had a dozen at one point!). They are truly wonderful pets. A friendly one can be as good as a pet dog. One of ours used to jump out of his cage when we were around, come and sit on the sofa and watch TV with us. I miss him!