@Christy142 I'm sure some other hosts might have tips, but this is really the kind of thing you could better learn training methods for from dog training books and videos, or paying for a few sessions with a reputable dog trainer. Not all dogs are the same- they are different breeds, different ages, they have different levels of territoriality, and different reasons for doing what they do. Also the owner's past ways of dealing with the dog has to be factored in- sometimes it's a matter of training the dog owner as much as the dog.
We don't even necessarily understand our own dogs. My dog is much like yours in how friendly she is, intelligent, loving, etc. But she has always barked loudly at any person or vehicle that goes down my little country road. I used to think she was territorial, but after going on holidays and leaving her in the care of various friends who also house sat here, what I found out was that she doesn't do that barking when I'm not here. So it isn't the territory she was defending, it's me.
Thankfully, she doesn't do that with guests. She barks at them when they first arrive, I reassure them that she's a barker but not a biter, and once she realizes I'm okay with them being here, and they are friendly and loving to her, she is nothing but friendly to them.