Lack of exposure and repetition is the main reason why this happens. If you only have 1 guest over per month, that's only 12 repetitions per year for your dog to learn what you'd like him to do. 12 reps isn't enough to teach a dog. Try to invite over a guest every other day. For those days that you can't get a guest to come over, have someone in your household sneak out and knock on the door.
Teach the "Right" Thing
Make sure you actually teach your dog what you'd like. As I mention above, practice it often too. In the video below we are working on a cue that teaches Lucy to walk up and sit in front of the new person. This is what is referred to as an "incompatible behavior."
Use Helpful Equipment
I recommend getting a front clip harness and using ad 4-6 foot leash for training this. Also, get out some very high value rewards. Using these things will aid your efforts.
Stay Patient and Positive
This takes patience and practice. If you get frustrated it won't help anything. If you don't do the things I mentioned above, you probably won't have much success, so make sure to do those. Doing those will help prevent frustration.