I hate to sound dramatic here, but this man's life could be in danger. With issues like this, odds are at some point in his life, he could either overdose (if drugs are involved), suicide, or be a victim of a serious / violent crime. Those things happen to folks in these situations, especially if he wears out his welcome suddenly and ends up back on the street.
My suggestion to you is to put EVERYTHING on the back-burner, and get this man some help. The catch here is that he may not want help, and as much as I hate to be "that guy," he may not be able to get better until he wants it. It sounds like he's smart enough to understand that his erratic behavior might threaten his job, and you want to help him get his behavior under control.
Some people need much, MUCH more than a steady job and a roof over their head. Long term success and balance will only come after the ROOT causes are addressed. Mental health professionals can usually help with this, if the person is willing.
Edited to change the last sentence to be less certain and include stipulations.