If you study mamma horses with their babies they give warning (swish of the tale, stop of the foot, ears back). If we want these babies to understand us we need to speak their language. Remember that they are still learning how to speak horse and are certainly not aware of what we want if it's not put in terms they can understand.
With that being said, here's my suggestion:
Chances are he is giving you some sign, and you are simply not noticing it, try very hard to study his actions, and look at his eyes to see when he gets that wild playful look.
To dieter his biting start by simply jerking your arm or hand or whatever he's trying to bite as if you have a twitch, but don't acknowledge his biting any more than that. This problem comes down to a respect issue. Even though you say he has good ground manners, if he's OK with coming into your space without being invited then he's just pretending to respect you most of the time.
Each time he tries to bite you jerk you arm etc. I find an elbow to be the perfect body part to use. Just flap your arm up like a chicken wing, very fast and very sudden. He'll either startle and move away or get an elbow to the face which should startle him and make him move away.
Look for him to lower his head, sigh, lick his lips, rotate his ears to you, or any combination of these things and then approach him and run his head. This will ensure that you don't end up with a head shy horse despite your discipline.
Now, you don't say if he is on a lead when he does this or free in the pen, or if he is reaching over to nip you or charging at you, but always match his energy, so if he's running at you run at him and be big and mean about it. Pin your ears back and tell him to back off.(Figuratively of course)
Since he’s been getting away with this it may take him a while to change his thought process and realize that you will not tolerate his behavior and that if he wants to come into your bubble he needs to wait for an invitation.
Best of luck, and let us know how it goes.