Escrow money is not yours. It is the borrowers' so you can't just apply the surplus to the loan amount. However, you may get the borrower's permission to do so or you may have rights under your loan contract. Here's a Q&A from HUD to help you understand:
Question #39: If the borrower's escrow account includes a surplus greater than $50 which HUD's rules require be refunded, may the servicer credit the surplus directly to the principal, rather than refund the surplus to the borrower?
Answer: No. However, the servicer may inform the borrower in the information accompanying the return of the surplus that the borrower may elect to use the refund to reduce principal or have it credited against the next year's escrow payments.
Question #40: If there is a surplus in the escrow account and the borrower is in default, may the servicer retain the surplus as payment towards the amount in default?
Answer: HUD's escrow rules are inapplicable to loans that are in default, which is defined under the RESPA rules as current payments which are more than 30 days delinquent. The parties should consult the mortgage documents or state law to resolve whether escrow funds are available for this purpose.
You can find the FAQs here:
One last note:
These provisions regarding surpluses apply if the borrower is current at the time of the escrow account analysis. A borrower is current if the servicer receives the borrower's payments within 30 days of the payment due date. If the servicer does not receive the borrower's payment within 30 days of the payment due date, then the servicer may retain the surplus in the escrow account pursuant to the terms of the mortgage loan documents. [1024.17(f)(2)(ii)]