Managing benches is difficult enough when you are a 4th official, when you are AR and it isn't your primary job then it sometimes can be impossible.
I would always introduce myself to them, tell them to let me know when they want a sub, and to try and keep it to no more than two people standing. Usually they were OK, needed the odd reminder to stay in the technical area or get one or more people to sit down, but of course it wasn't always that easy.
I have quite a calm character, and would try to appeal to their better side if they were getting out of hand. If that didn't work I'd resort to a "I don't want to do it, but ..." approach. For example, "I don't want to stop you being able to manage your team, but you can't keep behaving like that. If I get the referee over he will send you off, and remember that means you going back to the changing room, you can't sit in the stand" (a very useful rule we had at the time). Now this was a bit of a bluff on my part as the referee could choose to issue a warning, but most referees would know me well enough to realise that if I got them over a line had been crossed.
Sometimes the behaviour is such that you just can't manage it, a line has been crossed and you can't even try to manage them. I had one where a manager was screaming in my face, literally millimetres from me, and if I tried to move away he followed me. No choice there but to get the referee over and tell him he needs to go, ultimately the referee has the final say but he would be totally wrong in not backing your recommendation when behaviour is that bad.
I kind of agree with the don't defend the indefensible principle, but be careful. You can agree that a throw-in in a non-dangerous position looked wrong, or a free kick in a safe position looked wrong, adding that remember the referee has a different angle to us. But never do that for any decision that even has a chance of leading to a goal. A throw-in on the right wing level with the penalty area might look safe, but if they lob it into the box and a goal is scored, and you've agreed that the decision was wrong, you have well and truly thrown the referee under the bus. On those you have to either say nothing, or turn into Arsene Wenger in claiming that you hadn't seen it.