There are options for delaying or avoiding foreclosure, including fighting in court to the bitter end, working with the bank or mortgage company to modify a loan or get a deed in lieu, or filing for bankruptcy. Of these, bankruptcy is the only really sure bet. You file a federal bankruptcy suit and the state foreclosure process comes to a screeching halt. Before doing that, make sure it’s what you want.