From all that I have seen and experienced, the best way to avoid homelessness is to surround yourself with people who love and care about you. And you do that by being someone who loves and cares about others. In times of trouble, and yes, we all can face difficulties in life that could completely destroy our lives, we need caring and loving people to help us though them. Without such people in your life, you are at a much greater risk of becoming homeless.
Having people in your life who are loving and caring isn't always an easy thing to achieve. Many factors are involved, it isn't easy to just up and change your personality, and patterns of behavior, and all the other things that effect how people respond to you. But, if you think you could ever become homeless, then this is the area of your life you should work on the most.
I have received many emails over the years from people asking this question: "how to I avoid becoming homeless." They find themselves facing homelessness and don't know what to do. Sadly, at the point when you realize that you are on a path to homelessness, it's usually too late to do anything about it. If you've been unemployed for a while, and have received an eviction notice, have tapped out all your resources, you have no one to turn to for help, more than likely you will become homeless.
To avoid being evicted from your home, the best thing you can do is to stay in communication with your landlord. Keep them constantly appraised of your financial situation, and though you may have very little money, always give them the majority of it. If they are willing to accept a partial payment from you, then you are in a good situation. It is not easy to come back from being behind on rent because you find yourself, in essence, having to pay twice as much, if not more, than you originally bargained for when you first moved in. Suggest to your landlord a repayment schedule that will get you caught up with your rent in a fair amount of time.
Be willing to humble yourself to ask family and friends for financial help. Just be very careful about this, because if you get yourself into a financial mess with them, they just might end up disowning you. If you do get a loan from anyone, stay in constant communication with them as well, so to reassure them that they will get paid back and in a timely manner. And actually repay them, don't keep blowing them off. They won't put up with it for as long as you might think.
You can try going to local churches for financial help, but don't expect much, if anything, from them. Despite what you may know of the Christian faith, most churches either can't, or won't give money to a complete stranger, especially in amounts that would actually help cover rent and utilities. What funds they may have, they will want to save for the needs of their own congregation. So, yeah. If you the kind of person who is vulnerable to homelessness, it would be a good thing to become a member of a church. But, this goes back to surrounding yourself with people who love and care for you.
Most city governments have funds available to help people with rent and utilities in emergency situations. Qualifying isn't always easy, and requires jumping through many hoops. But if it saves you from becoming homeless, it's worth it. Unemployment Insurance can help, but you will only get a fraction of the monthly income you were used to, and it usually takes many weeks for the first check to arrive, once you have qualified. And those checks will not keep coming indefinitely. The same is true with food stamps. Although food stamp benefits come in one monthly lump, it usually amounts to only 1 dollar per meal. If you spend any more than that, be ready to go hungry before the end of the month.