Make sure you create a Sail Clear account. It is helpful if you input the boat information and passport information for your crew and yourself ahead of time. Once you are in BVI waters you can fill out a clearance application. Once you fill it out and submit it, you will get an email with a notification ID number. You give that number to customs when you go in to clear in. Don't go into the office without submitting this application as they get very annoyed and will then make you do it on the antiquated computer they have there...if it is working.
Coming back use CBP Roam. Sometimes the US doesn't even make you go into the office and will clear you online.