The answer to this question depends on if you have equity in your home and if you’re behind in your mortgage.
If there is no equity in your home, which means that the amount that you owe on the mortgage is more than the house is worth, and you are current on that mortgage, you’re likely going to be able to keep your house in bankruptcy as long as you can keep current on the payments.
If there is equity in the home, you may have more of a problem trying to keep it in bankruptcy because the trustee will make an analysis whether the amount that you owe on the house plus the exemptions you’re allowed to keep are less than the value of the house. If they are less, then the trustee may list your house for sale and you may lose your home. In that case, you don’t want to go into a Chapter 7 bankruptcy, you’ll want to consider a different approach to your financial problems.
If you’re behind on your mortgage you can use a Chapter 13 case to catch up on the arrears that you owe the lender. You can typically do that over a 60 month period. That’s one of the big advantages in a Chapter 13 case and sometimes why it’s better than a loan modification where you are uncertain about what the lender is going to do for a year or more.