Proper groundwork, clear boundries, consistency, make your aids "as soft as possible but as hard as needed". Lots of backing up, yielding and moving his feet will also help (in the right circumstances).
Groundwork - and lots of it.
Moving your horses feet left, forwards, left and right gives you control over your horse. It is your job as an owner to gain your horses respect through consistent groundwork, such as lunging, backing, yielding and, in other words, moving his feet. This is the only way your horse will become submissive and quiet around you, therefore becoming respectful of you and your space.
As soon as he shows you disrespect (ear pinning, barging your space, swishing his tail, etc) you need to put him straight to work immediately. Otherwise, he will continue with these bad habits with the belief that they are ok. Likewise, as soon as he shows you respect by lowering his head or looking at you with two eyes and ears, allow him to rest, telling him that disrespect = work and respect = relaxing.
Do not ignore his ear pinning (a popular 'rude' gesture). It's a threat from him to you, and if not addressed with work then it will progress to a bite. Same with any pushiness and other rude actions.
Punishment through pain, as I've unfortunately seen numerous times, such as hitting the horse, slapping them, yanking them, does nothing but make the horse fear you, increasing the disrespect he has for you.
Consistency and confidence are your friends here. Make the wrong thing hard and the right thing easy.
The most important thing is consistency. When you discipline them for bad habits it has to be the same way every time so that the horse learns. If you choose to discipline for a bad habit, every time that horse does the bad habit a bit of discipline must be applied with consistency and a calm demeanor so that the horse learns but isn't freaked out