If your dog is continuously begging to be petted, including at very inconvenient times, it is your job as its owner and pack leader to let it know when the behavior is inappropriate. As long as you are patient and have a little extra time, there are some steps you can take to discourage and end this unwanted behavior.
Exercise your dog. When a dog has pent up energy, it may follow you around begging to be petted and for other attention. Just like people, dogs need aerobic activity every day -- 15 to 30 minutes. Playing with your dog out in the yard, taking it to the dog park or going out for long walks every day are great ways to ensure your dog expends any extra energy.
Check your dog's diet. Your dog should be eating sensible portions of food each day so it doesn't build up extra energy from too much food. If you are unsure about how much you should be feeding your furry friend, use a dog food calculator such as the one found at DogFoodAdvisor.com or consult your veterinarian.
Give your dog a job. Dogs love to be given tasks because they perceive it as attention. If you spend a little time each day teaching your dog new commands and practicing the ones it has already learned, you can quench some of its need for attention. It might be less likely to beg to be petted at inconvenient times.
Ignore your dog when it begs to be petted at inopportune times. As easy as this sounds, it requires a lot of patience and follow through. There are stages your dog will go through when it is begging for this attention and you ignore it -- its begging behavior will worsen, it will then be unsure its behavior is working and finally it will stop the behavior altogether. This process will only work if you stick to your guns and ignore the begging every time it is inconvenient.
Praise your dog when you want to pet it. When it is a convenient time to pet your dog and show affection, use positive reinforcement, such as verbally praising it or giving it a treat. This will let it know that it is okay to seek your attention at these times. Do not praise your dog when you are busy, such as reading the paper or visiting with friends. Soon your pup will be able to distinguish when petting is acceptable.