Training! Plain and simple.
My 90 pound Lab, goes everywhere with me with no leash or collar.
He heels at my side, won't even stop to sniff or lift his leg until released to do so.

See my thread below and you'll see prey drive.

He knows what's acceptable to do and when and what's not.

He was trained properly.