My rule is you never teach counting to three, as they become desensitized and when it is urgent they are waiting for you to count!! That is wrong on so many levels so not sure if you count, but don't. Alethea's word "FREEZE" Is great, it isn't stop or no, but something they que that makes your request VERY IMPORTANT. All the boys I watch know this word when we are outside. They are to freeze!
Second, tell him once, then if he doesn't listen, pick him up and remove him immdediately. If you are outside, ask him to stay away from the street, if he doesn't listen, take him inside immediately explaining he HAS to listen to you at all times.
If you go somewhere, confine him to a stroller or shopping cart telling him that he doesn't listen and when he starts staying with mommy you will allow him more freedom. Make him earn it.
It took my son a while as he wanted to walk with me at the grocery. Trial and error and him being put back in the cart several trips now he will stay with me, I keep him occupied with helping me put in apples and pick out stuff, but he stays with me. If he walks away even just once, he is back to the cart!
Be very firm, consistent and don't assume time outs don't work, it takes a while before he gets he will be punished. Time outs don't work overnight. the best thing is to immediately stop the activity.
Don't wait until he is in the street, tell him once and then get him away from the street or tell him he isn't allowed to play outside if there is a street because he is CHOOSING not to listen.
When he gets he has to listen, then explain how badly a car can hurt him, explain there are strangers out there and him running off is not okay, be honest, even blunt. Both of my kids know exactely why I have rules like this.
They get crazy inside and someone always gets hurt, at their age 4 and 7, my typical response is caring they got hurt but also reminding them why I tell them to calm down inside!!! Takes a few times and they got it! :) Hang in there.