If it is your neighbor's dog that is the problem, you might want to inform your neighbor if you are installing the stakes. There is a very slight chance the dog could injure itself on them somehow (splinters, get his head stuck, etc.) and this might encourage keeping the holes more securely filled and attended to. In addition, a large dog might chew on wood stakes all the way through, so metal might be a better choice, depending on what you are dealing with. This goes for your dog as well, and large splinters could potentially cause problems, so keep that in mind. As an alternative, you might be able to find the stakes in hard plastic or PVC.
If you have a chain link fence, you can use wire to fasten the top of the stakes to the fence to avoid the bottom of the fence bending and the dog crawling through anyway.
Does your dog keep digging under your fence and running away? Does your neighbor's dog repeatedly make tunnels big enough to drive a train through under your fence and it is causing some stress between your neighbor and you?
Usually, in the effort to stop dogs going under fences, rocks are piled into the holes, but dogs are persistent, and they can dig through even some of the hardest ground faster than you can fill it in.
There is a fairly easy solution to the problem, and it should remedy the issue permanently, regardless of which side of the fence you are on. It's not just dogs, either. A variety of other animals love to tunnel under fences for food or for other reasons. For animals that don't tunnel five feet down (and there are some that do) this should keep your garden from rabbits, possums and woodchucks. Some cats like to go under fences, also, but they are so good at climbing, they mostly just go over the top!
Once holes are made by an animal other animals will use the tunnel to come and go. Trying to keep up with either them or the dogs is a full-time job.
Try my suggestions below and see if it doesn't just work like a charm.
Measure how many feet of fence you need to treat.
Determine how far apart your spikes (rods, etc) need to be to prevent the specific animal from passing through. For instance, if you have an adjoining fence of 50' and your neighbor's dog is a medium-sized dog, then you might choose to place your stakes about 10" apart. For a bigger dog, you may go with a foot apart or more.
Look online or at your local building supply for either metal stakes or wooden stakes. You need to be sure that you can drive this stake 2'-3' into the ground with a mallet or hammer. Some soils would be difficult to use with wood, and would need a thin metal rod with a point.
Check out websites that sell camping gear for tent spikes. These are strong and pointed, designed to be driven into some very hard terrain. You may not need something that strong, but it is one source for obtaining strong spikes. You can find them used on eBay or Amazon.com.
Make sure that your stakes are long enough and that you are going to be able to pound them all the way to the ground, or nearly so, depending on how you are designing it. You want the lawn mower to be able to pass over them and you want to make sure that they do not present a hazard of any kind. There are stake "caps" you can buy to mark them, or you can paint the tops if they stick up, as a reminder.
Hammer the stakes right next to the fence at intervals you have determined are sufficient, for the length of the fence.
Be cautious about buying the wooden stakes due to the cheaper price, as they have more drag going into the soil and are much harder to drive in.
Consider rebar (used in construction) if you can cut the metal rods, as they are fairly easy to find if they will go into the ground without too much trouble where you live.
Look for hard plastic or metal garden stakes at a garden supply store. Again, just make sure you can get them deeper than the dog (or other animal) will dig.