I SO understand where you're coming from. I have tried a tip given to me where I should just start asking questions about people b/c they love talking about themselves. However, this also means a lot of the ones i talk to don't know when to use the STOP button. When I try saying something to them they'll either brush me off or say something really short in return and keep on talking about themselves. Even worse, sometimes they'll act ANNOYED if I tryto say something while they keep blabbing on with their oh-so-important stories. After a while I want to punch them in the face. It feels so hard to find a happy medium between people who will be willing to listen to you and people who can talk enough to not make things awkward.
The best thing I would try (I am still like you though, stuck in a rut about this) is to be really assertive when you want to say something. I know I have a problem with reducing my voice to a mousy-soft tone that sounds kind of weak and "erm, can I say somethi- oh, you're still talking..ok i'll shut up again." so people either can't hear me or they won't listen/take me seriously. You kind of have to shove your way in there if you want to be heard or else they'll walk all over you. It's really hard, I know because sometimes you can't even find a moment to say anything cause they won't shut up.
Another thing to do is to, like what caraamericana said, just act like you're not listening anymore. Most of the time people will get the hint. And again like what she said if people give you a hard time about it just tell them that they are talking too much about themselves. I'm the kind who doesn't want to offend anyone, so I don't know if I have the guts (yet) to do this, but it's definately worth a try and it'll probably make them listen to or respect you more.
Also if you're friends keep doing this and keep disregarding what you have to say, either sit them down and tell them or find new friends. One of the key qualities in having a GOOD friendship is that both sides will LISTEN to each other, not always do the talking. And right now it sounds like they're being pretty crappy friends if they keep doing that to you.