The Brgy. Captain cannot just demolish your house. There must be a court order before any demolition can be done. He has no power to demolish outright your house based on his own survey. You need to reply on the demand stating that there was no encroachment and stand on your ground.
By the way, when you built your house did you apply for a building permit? When you bought the lot, was it titled?
The Brgy. Captain has no authority to issue an order of demolition especially when there is no court order to that effect. If the Brgy Captain proceeds with the demolition, you can file an adminsitrative complaint for grave misconduct and oppression before the Office of the Ombudsman.
Assuming that the surveyor was right and you have in fact encroached on the barangay's property, do not worry there is what you call in law a builder in good faith. When a person builds in good faith on the land of another, Article 448 of the Civil Code governs. Said article provides:
ART. 448. The owner of the land on which anything has been built, sown or planted in good faith, shall have the right to appropriate as his own the works, sowing or planting, after payment of the indemnity provided for in Articles 546 and 548, or to oblige the one who built or planted to pay the price of the land, and the one who sowed, the proper rent. However, the builder or planter cannot be obliged to buy the land if its value is considerably more than that of the building or trees. In such case, he shall pay reasonable rent, if the owner of the land does not choose to appropriate the building or trees after proper indemnity. The parties shall agree upon the terms of the lease and in case of disagreement, the court shall fix the terms thereof.
Moreover, you also have the right to be indemnified for the necessary and useful expenses you may have made on the subject property. Articles 546 and 548 of the Civil Code provide:
ART. 546. Necessary expenses shall be refunded to every possessor; but only the possessor in good faith may retain the thing until he has been reimbursed therefor.
Useful expenses shall be refunded only to the possessor in good faith with the same right of retention, the person who has defeated him in the possession having the option of refunding the amount of the expenses or of paying the increase in value which the thing may have acquired by reason thereof.
ART. 548. Expenses for pure luxury or mere pleasure shall not be refunded to the possessor in good faith; but he may remove the ornaments with which he has embellished the principal thing if it suffers no injury thereby, and if his successor in the possession does not prefer to refund the amount expended.
Seek the assistance of a lawyer in preparing your reply letter and in anticipation of a court case to properly protect your property.
Good luck and God Bless!