Sounds like Rajah’s enjoying a pretty good social life! There are many logistics missing from your question, but I’ll answer assuming he’s running out the front door rather than jumping over a fence. The first thing to do with Rajah is begin a basic obedience course with him, either in a group class or with an in-home trainer. Learning the basics of teaching your dog using gentle, fun and science-based training will help tremendously with your training routine.
Sit down with pen and paper and make a pros and cons list of gains/losses from Rajah’s perspective of his darting to your neighbor’s house. His list will have all pros, such as: See my dog buddies, play, steal toy, play, grab treat off table, play then play some more, come home and sleep. His list will now be your list of incentives for him to comply to your requests. As you can see, Rajah loves to play! Any self-respecting dog would try to run towards an opportunity to play if it isn’t provided for him sufficiently during the day. It’s a very strong drive for many dogs, often more important than food! Use that strong pull toward playtime as a reward, rather than trying to put a cap on a huge “dog-energy” volcano. It’s much more fun and easy than chasing after him.
To get started, read the Go To Bed handout, and teach Rajah the routine in that handout using upbeat, fast-moving and brief sessions. You’ll be teaching him to run to his bed when someone’s at the door, which is a good time for him to try to sneak out. To help keep him inside and happy when the door’s open for you to come in or go out, get him hooked on Kongs – read the How To Stuff A Kong handout, and keep at least three or four stuffed and ready in the fridge. When you’re headed out, grab a stuffed Kong and have him sit at least 20 feet from the front door, then toss him the Kong when he responds to your command. When you come home, quickly shut the door and run to the fridge very enthusiastically, have him sit, then give him a stuffed Kong. If you do this every day for three weeks, he’ll begin to switch obsessions from his buddies next door to the stuffed Kong. This is called “operant conditioning.” It’s also called a great way to get his behavior under control!
Keep in mind how strong his desire to play is and think of ways you can use his playing as a reward. Does he walk nicely on leash? Arrange this with your neighbors: Go for a walk then take him to your neighbor’s house on leash, as long as he’s not pulling. Have him sit quite a few times as you near the house to have him stay focused on you. Reward the last sit when he’s in a safe area by unclipping his leash. Of course, you can also take him to the dog park to meet new buddies! You can also have your neighbor’s dogs over as a reward to Rajah during a training session. This would be a great way to have him get his ultimate reward at home, rather than next door. You’ll have to ask your neighbor to be ready at a certain time to bring the dogs over (leashed, of course), and just after getting a good response in a training session, speed-dial your neighbor and tell ‘em to run over! Bridge the reward with lots of praise before they arrive.
Please remember that dogs need at least one hour of exercise a day (if they’re healthy and their vets approve); behavior for the day is dictated by how much energy your dog has to expend. If he’s not properly exercised, a myriad of behavior problem can crop up, such as: Excessive barking, chewing inappropriate items, jumping on people, digging holes in the yard, running out of the front door, etc.
Training should be a fun, bond-building “game” you and your dog play. If you’d like to have a trainer in a class situation or have one come to your home for a visit, a great place to find a trainer who uses positive reinforcement and motivational techniques is APDT.com. Just click on “Trainer Search,” type in your zip code and a list of nearby trainers pops up.