If it were me, I'd probably try grabbing a coffee/tea/beer with him outside of the office, if possible (or, if you have your own private office, then that'd work too), and just talking with him about the situation, peer to peer, and try and understand what's causing this behaviour.
Just try to be tactful about it. Even broaching the subject may be a bit awkward, but if you can figure out a way to discuss this with him in an amicable way, it may be worthwhile.
It kind of sounds as though he's in a very stressful position. Maybe it's just the stress?
It could be something simple. Maybe it's something you're doing or not doing that irks him somehow. It's also possible that it could be something completely outside of you and the company, and he's just taking it out on you inadvertently.
Consider empathizing with him and try to figure out what's going on. Odds are there's actually a reason. Once you figure out what the root of the problem is, you're more likely to be able to figure out how to make things better.
If it's something you can do to help, you can try and resolve the issue. If not, just try to come to an understanding that there's no hard feelings; that you'd like to at least remain cordial, and even friendly, if possible...
In my humble opinion, getting HR or your/his boss involved as mentioned below/above may work on the surface, but you'd likely just be forcing him to suppress whatever it is that's upsetting him... not sure how well that'd go in the long run. At this stage, I'd go for the "talk with him" route. But maybe that's just me.
If you talk with him and it doesn't help the situation, then at least you truly tried getting to the root of the matter.
I dunno, just a thought for your consideration. I hope this helps somehow.
Disclaimer: I've never been in this situation before... this is just my two cents on the matter.