Things like this happen in small companies. People have stuff going on in their lives that makes them bad bosses for a while. One of my clients had a very bad year while his wife died of cancer, for example. There was no-one else to carry the weight for him as there might be at a large company.
What can you do? If your boss has a boss, you can ask that grandboss for a meeting. It's possible the company doesn't know what's going on. They can take it from there. But if this is a small company and there is no-one above the boss, you have to decide what to do. You have a couple of options.
What I would probably do is decide he has something big going on in his life (illness of himself or someone close, marriage failure, offer to buy the company, loss of a huge deal causing enormous financial pressure he is trying to hide from you, or the like) and that I will do my best to help. That means sending lots and lots of status emails (as opposed to "what should I do" emails) to try to prevent off-hours rambling phone calls, taking on decisions where it seems I must, and patiently explaining things that shouldn't need explaining. The hope is that by stepping up, the company as a whole can carry the boss through the tough time and afterwards all carry on as before.
Also, the very actions that make things easier for you also make things easier for your boss. The off hours calls are because he suddenly realizes he doesn't know something, and he can't wait until morning to ask, for whatever reason, so he calls. If you just fire information at him as you get it (we just deployed to that customer site, I just got off the phone with X and he's happy, looks like we're getting more work on project Y next week and we can handle it fine, Steve is back from being home sick) then when he wants to know something, it's in his inbox and there's no phone call. Providing full context in every email and including summary lines at the top (Eg start the email with The status of customer John Smith is all on schedule, customer happy, then carry on with details) are habits that will serve you well under normal circumstances as well as exceptional ones. Managing more of your own workload and looking to the bigger picture because no-one is there to do that for you will also grow you as a developer or whatever it is that you are.
Some people wouldn't be willing to work that hard unless they knew it was a temporary situation that "deserved" the help. So if the boss was spiralling into addiction, or the company was going to fail no matter what, they would bail. Such a person should meet with the boss and ask "what's going on?" so they can decide whether to help or not.
Still other people will see the writing on the wall and leave. Get the resume up to date, and adjust what they do at work to support the goal of getting a new job over the goal of carrying this boss through the troubles. That's not a bad choice: if you could run a company as well as this guy, you would probably be running a company, right?
There are more creative approaches, too. For example if you ask the boss "what's going on?" and get a "deserving" answer like a dying wife or whatever, you may be able to suggest getting a consultant to help run things for a year and keep the company afloat. But you would need to provide a lot more detail for anyone here to be able to help with that.
The key, to my mind, is to determine whether anyone can take over for the boss (likely in a large company) and if not, whether you're willing to change your work style to help this situation for a while. It could be very rewarding ... or you could just be the last rat to leave the sinking ship.