Gain one another's respect with a lot of groundwork (lunging, backing, yielding hindquarters, etc) to ensure he respects you.
If he still seems to be stubborn after a lot of groundwork, I suggest you get his tack checked to ensure he isn't in any pain or discomfort which could be resulting in his behaviour.
If his tack is fine and you've worked him on the ground for a week or two and he still shows unwanted behaviours while riding and always seems to 'get his way', then let him get his way.
But don't make it easy.
You allow the horse to make the mistake of putting himself into more work than he needs to instead of saying 'no'. If you tell him no and try and get your own way, the horse will most likely win, and that's fine. But make it difficult to 'win' and he will want to listen to what you are asking rather than making his own way be harder work.
"Make the wrong thing hard and the right thing easy"
As soon as he puts a step wrong, work him a lot and return to what you were previously doing. If he puts another step wrong, work him again.
This is the most reliable method I've used. Punishment never works, but making the horse work harder than he needs to does.