What everyone says is true regarding avoiding foreclosure. Banks want the money, not the house.
However, you cannot stall them forever. I went close to this dairy farming. If they believe you will NOT pay, then they will get those wheels right out and rolling...
I found this out back in oh.. 1986...
Kept my credit and they did not foreclose.. it got a bit touch and go between the mortgage and the feed bill. Ultimately the mortgaged farm sold and I rented it back for an annual rent that was what a month of mortgage had cost me. Sweet!
BTW just because the bank WILL loan you the money does not mean you can PAY the payment. I have had some bad advice from the bank on how much they will lend.
Be careful. Follow the advice here. Others have more experience than I.