I had a dog when I did my MA, and I honestly would never have gotten through it without him. Every time I was stressed, there was Jasper with his crazy antics to make me laugh. I was forced to get outside regularly to take him for walks, which meant taking more breaks and also helped with stress. Every time I got home after a long day, he was there to greet me with such enthusiasm that it was as if Christmas had come again.
Now that I'm going for a PhD, I'm once again entering a program with a wonderful little dog. Daphne is the most cheerful, bubbly, snuggly pet in the world! She got me through two stressful, horrid years as an overstressed teacher, and I've no doubt that she'll be the perfect cure for many graduate woes, too. Studies have shown over and again the immense value of pets for both mental and physical health of their owners.
You do absolutely need to have housebreaking at least at a 75% success rate before you start your program, or else it will add way too much stress. Also, it's a good idea to invest in a baby gate (easy to find at garage sales or on Craigslist) so that you can pen your dog into a bathroom, kitchen, or other non-carpeted room when you're away if it's for longer than 4-5 hours at a time (a crate is great for training, but if a dog is in for too long, it can have an accident and then get stuck sitting in its own waste -- this happened to me before and I felt HORRIBLE for my poor dog).
Also, another tip: Build your study/work-at-home schedule around the dog, with walk breaks, play breaks, and training breaks built in. This will keep you working in healthy chunks of time and will automatically ensure a healthy amount of breaks. I'm a bit of a workaholic in academia, so having a dog really helps me to keep healthier habits.