Hopefully you got a deed of trust along with the note. You should record the Deed of Trust - not the note. You should also record a request for notice, so that the first will be required to send you notice if they go to foreclose.
As for protecting yourself if they do foreclose:
- As a junior lien holder you may be able to advance payments to the first and add them to the balance. You’ll need to check the agreement you have with your friend - standard form deeds of trust generally allow this.
- If you aren’t receiving payments as agreed you could foreclose (you’ll need a deed of trust to do a non-judicial foreclosure, otherwise you’ll have to take him to court for a judicial foreclosure).
- If it does go to sale you can bid to at least make sure the purchase amount is higher than the amount you are owed - if you “win”, then you’ll take possession of the property and can try to sell it to recover your money. If you “lose”, your entitled to any excess proceeds (the amount above what was owed to the senior lender), up to the amount you are owed. Note that since you lien is unrecorded you may find that you are now junior to other debts, so you’ll want to make sure you really are next in line or you may have to bid even higher. This option is tough because you’ll need cash to cover the amount of the first, plus the amount of your loan in order to bid… sounds like $450k minimum to protect your position.
Finally you should hire a competent attorney to make sure your paperwork is in order, your lien is properly recorded, and that you really are in 2nd position as it will significantly increase your chances of not losing your funds, or putting yourself in a position of having to sue your friend to recover the money.