A.S.
#1 Rule Be consistent.
#2 --Have a plan!
When he acts up or you tell him no, whatever--what is the consequence for his behavior? Talk to him about it first. "Say mommy hasn't been doing a real good job about being consistent, but I want to be better. This is how I am going to do it so that you can be safe. Sometimes I have to ask you to do things that are not what you want to do b/c I am keeping you safe." --Whatever--you get the jist. Then he knows in advance next time, this is going to happen... plus he can empathyse ?sp. with you--kids are so great at this!!
Also, I love to do positive reinforcement. Like have a plan! :) When we go to the store, you have a chance to earn three... whatever starburst--then each time in the store you catch him doing a good job--listening, whatever--BINGO give him a starburst. Then he is focused on doing the right thing. He may only get 2 of the three, but he is working on the right things. But, if you have the consequences in line, you have that ready too for an immediate.
I really think planning is crucial--what are you going to do if he acts up in the store, in the car, at the movies, at the airport? etc. That way you are prepared to handle it nomatter what. :) Good luck!