Having a dog friend is having a friend for as long as you both shall live, that's how loyal dogs are. Still, curiosity is part of their nature and so is making new friends, both dogs and people, so it's not unusual for dogs to wander off from home every now and then.
In the best case scenario your dog could be back, happy that it met acquaintances, and in the worst case there are all sorts of trouble that could arise, from being run over to being lost which is why it's your obligation as the owner to do whatever you can to prevent this from happening.
If you haven't already resorted to the electric dog fence now is the time to do so. It's a great option even more than traditional fences because it prevents dogs from crossing over, including those that haven't been trained or have issues with obedience, while at the same time it doubles as protection from unwanted animals at your property.
Besides, if you go for an option like the solar powered electric dog fence you wouldn't have to worry about additional costs as it uses the renewable solar energy to work, ideal also for locations where there's no access to electricity.
Same as cats, male dogs are impossible to keep at home when they sense there's a female dog around, especially when it's mating season, so one of the ways to prevent your dog from running off to breed would be to neuter it. It's not much different when having a female dog either, so unless you plan on having puppies, it's advisable to spay it.
To be on the safe side, it's important to invest in some training supplies, like collars that are designed for remote training, and start teaching your dog some basic obedience exercises. If you find you're not exactly cut out for a dog whisperer and don't handle training well, then it's best to invest in exercises from an actual dog trainer.
Dog trainers have experience and know the different needs of different dog breeds and are able to tailor specific exercises that would work out best for your dog. And of course, it's essential that you spend as much time together as possible, because your doggo might be needing some quality time with you and anyway the two of you together is great for the health and well-being, particularly when spent on walks and running.