|Your boss's antics are his little way of dominating you, and you have been the willing victim. He is going to continue to kick sand in your face until you draw the line in the corporate sand. The time has come for you to do just that.|
On your next assignment, put everything you can in writing, and then give him a copy of your plan to tackle the work. Meet with him at frequent intervals during the life of the project to let him see that you are on track.
Sooner or later, he's going to get inappropriately critical of your work. When that happens, you should respond in a firm and businesslike way, look him squarely in the eye, and not only show him in writing that he is wrong, but tell him that his outbursts are unacceptable and have to stop right now. Then be quiet.
Sometimes people like him need to see how far they can push others, and now he knows. That may be all he needs. But, if he feels the need to start up with you, then you should start up the ladder and discuss the situation with his manager.