Chapter 13 may be the answer. Chapter 13 is a repayment plan over a period of 3-5 years.
Reinstating your mortgage loan may seem hopeless because the mortgage company wants all the delinquent payments lump sum. But Chapter 13 allows you to cure the delinquency over a period of years. Chapter 13 gives you time ordinarily not available outside of bankruptcy to catch up house payments.
The foreclosure lawsuit stops when the Chapter 13 case is filed. Until your home is sold you may be able to file a Chapter 13 case.