These preflop calls really aren't that bad by the other players (at least if it was T9s), as it seems like they correctly assumed that they have big time implied odds, possibly because they know you have a high pocket pair from your 4.5xBB and 4xBB bets. You aren't really giving them bad enough pot odds to counter the implied odds they have, but you're also betting enough for them to put you on a big pocket pair, as I'm guessing that that isn't your standard bet when you have a hand like AQ, which wouldn't give them near the implied odds that they otherwise have.

With implied odd type hands (low pocket pairs and suited connectors), the ideal situation is exactly what's in these hand histories, which is the opposing player has a big pocket pair and you hit the flop hard, and they don't see it coming when you take their stack.

Personally, I call in both of these situations with 22 and T9s in the big blind in a ring game. Although I think its more profitable in the game I play in than in this one, as this one has stack sizes of 50 BBs and mine has 100 BBs, and you're really hoping to hit and take their stack in these types of situations, so the bigger stack size compared the blinds helps. In a tournament, with big blinds, its a different story, but in NL ring games, implied odd hands can really make you a lot of money in the long run. Its really probably where I make the most of my ring game money, as when you're playing against tight players you aren't going to win the real big pots unless you have a monster (preferably a hidden monster like these) against another big hand. Although it helps that I develop a loose aggressive image, stealing a lot of small pots to set up big wins when I have a hand, too.

As for what you can do to avoid being trapped in these situations, that's tougher. I'd probably keep my preflop bets consistent to start with and be a bit more cautious post flop. Some people make extremely big preflop bets to protect themselves, which is something you could consider as well, but its really not my style as it has to limit the amount of money you make when you win (as it would greatly limit the number of callers you get, and probably often just pick up the blinds), even though it'll almost certainly increase your ratio of wins to losses. But one thing is for sure, adding an extra BB to your bet probably isn't worth tipping everyone off to what you're holding. Bet what you usually do or make a really big bet (6xBB or more). Again this is very different than in tournaments with bigger blinds, where that 1 BB can make a much bigger difference in whether someone with a hand like that will call or fold.

As for calling their big raises, like in the first hand, you really have to know the player, at least a little bit. Would they make this move with AT? Would they with a flush draw? Many players wouldn't do either, and if that's the case with these players, you need to get out. Also you need to note after a hand like this that the player didn't slowplay his set, and shoved in immediately so you can watch out for that later on. On the second hand you're nearly pot commited because you seemed to overbet the flop. As is, you probably couldn't get away from calling the raise very often, but if you bet less it would've been much more likely, especially with that minraise that looks like slowplaying (another thing that should be added to notes). It wouldn't make much sense for him to minraise with AJ or a flush draw, with such a big bet being made in comparison to stack sizes already. Both of those hands would likely shove all in if they were to raise.

I can't really think of much else that'd help to avoid being trapped like this, but hopefully this post can help you a bit. I'd possibly consider switching to a table / site that has bigger buyins as compared to blinds as well, as you don't have a whole lot of wiggle room here. If you're feeling pot commited on these raises, that could make a big difference, making these tough laydowns easier.