I dread taking all 3 of mine to the library! They're the same age spread as yours, but a bit older (DS7, DS4-almost 5, and DD2). They all 3 are so excited about being there and it's like kids in a candy store with them, they truly can't control themselves and I think it's only made worse by the fact that they *know* they should. It's also how we end up with (and I'm not kidding) no fewer than 50 books any time we leave the library when I take all 3. It's easier to say 'yes' to every book request than to fight with them. And honestly how do you say 'no' to a little face telling you the only thing in the world they've ever wanted to read about was the life cycle of the zebra butterfly? lol
For any outing, we do what DH calls "rules of engagement". When we pull out of the drive way we talk briefly about what behavior we expect at the destination. I make it a fun game and come up with crazy scenarios to get the kids laughing but also thinking about the expectations. "What if a green alien landed in the middle of the store? Would you run off to see what his spaceship looks like? No, that's right, you would stay right by Mommy's side!" "What will you do if your brother makes you really, really mad because he's singing a song *you* want to sing?" When we got to the destination, I turn the car off and then turn around and make eye contact with the kids "Remember, I expect you to behave appropriately. That means, no hitting or yelling, you walk with Mommy and I don't want to see any fighting. Does everyone understand?" If they seem particularly restless or I have a bad feeling about the trip, I add in the "abort mission" clause. "If I have to speak more than 3 times to any of you guys about your behavior, we are leaving and won't be able to get/have/go to _______."
It doesn't make it perfect and I still occasionally leave stores with my head hung low, muttering under my breath and my cheeks burning with embarrassment. But, it does help make the kids more cognizant of the fact that their behavior effects other people and while it may be fun for *them* to go careening quickly around a corner in Costco, the little old lady with the 2000lb cart won't find it nearly as amusing.