The answer to your question is too complicated for this forum. The circumstances depend on the exact facts of your situation. Without knowing all the facts, including ones missing from your statement such as why you believe a permanent loan modification will be denied, anyone here can only guess at the circumstances which might allow you to "stop" the foreclosure.
You should be aware, however, in nearly all cases a nonjudicial foreclosure will be completed and valid unless, prior to the foreclosure, you tender the amount demanded to the lender.
Failure of the trustee to follow notice procedures may allow you to delay, but not stop, the foreclosure. If the sale proceeds in spite of a valid agreement for it to be postponed or cancelled, the sale can usually be set-aside.
A Chapter 13 bankruptcy will allow you to make up the arrearages through the Plan over 5 years. In many cases, this is the most viable alternative for a debtor who does not qualify for a loan modification and who cannot meet the tender requirement.
You may wish to view my blog posts here: https://mrdaymude.com/?s=foreclosure&submit=Search for rights that may be applicable to your situation following foreclosure, and for some of the circumstances courts have determined give rise to a cause of action against a lender for wrongful foreclosure or injunctive relief. There is more than one page of posts so be sure to click the “previous” button at the bottom of the first page.
SINCE 1974. My answers are for general information only. They are not legal advice. Answers assume California law. I am licensed in California, only. Answers must not be relied upon. Legal advice and counsel must be based on the interplay between specific exact facts and the law. This forum does not allow for the discussion of that interplay. My answer to any specific question would likely be different if that interplay were explored during an attorney-client relationship. I provide legal advice and counsel during the course of an attorney-client relationship only. The exchange of information through this forum does not establish such a relationship. That relationship is established only by personal and direct consultation with me followed by the execution of a written attorney-client agreement signed by each of us. The communications on this website are not privileged or confidential and I assume no duty to anyone by my participation on Avvo or because I have answered or commented on a question. All legal proceedings involve deadlines and time limiting statutes. So that legal rights are not lost for failure to timely take appropriate action and because I do not provide legal advice or counsel in answer to any question, if you are an interested party you should promptly and personally consult with an attorney for advice and counsel. Also, see Avvo's terms and conditions of use, specifically item 9, incorporated by this reference
One suggestion is that you use your on-time and full trial mod payments as ammunition if and when they deny you a permanent modification. At that time, just see a competent professional to try to determine that you indeed qualify for a permanent modification.