WHat I would do is not nearly as important as what YOU did at that point? So what did you do?
Me: Carefully explain to the nice officer exactly what is up with this dog. Suck it up and be nice, he can't do anything to you except maybe be a prick. Nod head up and down, and say "yes sir, yes sir, three bags full sir". Then after he leaves, walk up and rap on neighbor's door. "Sir, that one was a freebie. There are leash laws, it would probably be in the best interest of all your neighbors, myself included, if you did not allow your animal to roam freely and terrorize the neighbor hood. A dog running loose in my yard could be lawfully be construed as a threat to my wife and family". Hopefully he gets the hint.
If it happens again, call the LEOs and say "there is a dog running loose in my yard, and it is acting very aggressive toward my wife who was in the front yard. If it appears again in my yard, I will shoot it in lawful self defense". Watch them come running, they will deal with it then.