I agree with both you guys. But I assumed the OP was saying he had this problem when he's not sailing, i.e. when the main is flaked and he snugs the sheet to keep the boom from swinging back and forth? Maybe not...
The halyard run back and clipped to the outhaul or a ring at the end of the boom and tentioned should prevent this. The halyard should be run back anyway as a courtesy to others in the marina.