Talking louder yourself is definitely not the way to go, but don't talk too quietly, just about on the same level as most people, somewhat louder maybe if the situation requires it (music, annoying LOUD talkers haha). If it's a personal convo between the two you're stuck between you're best off just moving for a minute and go talk to other people.
I often just ask what they're talking about and forcefully insert myself in the conversation lol. If things like this would still be a bother I'd just bring it up, but this probably depends on the group and situation if this is doable.
The main thing would be gaining confidence in these situations, such that you just "get good" at talking, no idea how to get it though. It kinda is indeed about social hierarchy, but witch closer friends it's more about having interesting things to say in a variety of possible conversations. One thing is that you shouldn't overthink things you said or you did, people don't remember minor things, don't overthink like you might do, and there's definitely not much weight added to some more stupid things you said/did.
If I got repeatedly told to shut up, I'd tell 'em to fuck off tbh. I think I have rarely witnessed a serious "shut up man", at most a "sorry man, I wanna hear what he was saying". It might be that you're doing some other things wrong though, like trying to "force" yourself in the wrong conversation at wrong moments (like talking about really serious and heavy stuff when they're just talking about random shit, or the other way around). In "difficult" groups I like to have a friend that I know really well and where we both know that we really like each other nearby, so if I'm bored or not really included in anything I can talk to him, that way you can move on together to conversations with more people. Not feeling comfortable for me kinda equates with not really liking the people I'm with though, so this is a question you might have to ask yourself.
As for specific tips, I don't know, these can be kind of intense situations, but some beers help to smooth things over. Sometimes I remove myself to get a beer, bring some drinks for people who want something and when getting back I'll have thought of a couple interesting things that can spark nice conversations at dead moments.
All in all, just about making good friends. When you're not one of the people directing conversations, it's about feeling what is right and when. To me this comes natural, but I have a couple of friends I see struggling with this from time to time. As a good friend you try to make 'em comfortable and actively ask something if someone is left out, then things come more natural.
So yeah, come up with interesting things, maybe go talk to someone that is also fairly quiet, bring up your concerns with someone if this would be doable. Going outside with some people to smoke is also good, breath of fresh air, smaller group with different dynamics. People love to fucking talk so if someone is telling a story or something, laugh at some joke or story, affirm his/her feelings, share something in a similar vein yourself. That way you develop connections with some people that are not the dickheads ignoring people or telling them to shut up constantly. You might be close to these things and it's just a couple hoops to go through. But above all, be yourself, otherwise people see through that, even if it's subconsciously.
Don't know if this helps, I have too much energy. Good luck