If you have a dog, you've no doubt watched him when he's dreaming. He twitches and whines and maybe his legs go racing in the air or his tail starts to wag. But what's going on in his slumbering world? Is he chasing a squirrel or ravaging the pantry?

Scientists are pretty convinced that dogs dream just like we do. In fact, like us, they tend to replay their day when they hit the sack.

How we know dogs dream

More than 15 years ago, researchers at the Massachusetts Institute of Technology trained rats to run around a circular track for food. They monitored the rats' brains during that task, and then again when they were asleep. When they ran, their brains created a distinctive pattern of neurons firing in the hippocampus, the part of the brain known for memory. That same pattern emerged often during the rats' REM sleep (which is where dreaming most often occurs in humans). That made the researchers believe the rats were dreaming about running in the maze.

"No one knew for certain that animals dreamed the way we do, which can involve replaying events or at least components of events that occurred while we were awake," said study co-author Matthew Wilson of MIT's Center for Learning and Memory, in a press release. "We looked at the firing patterns of a collection of individual cells to determine the content of rats' dreams. We know that they are in fact dreaming and their dreams are connected to actual experiences."

The oft-cited study was published in the journal Neuron.

Wilson said, "dreams are the ultimate off-line experience. This work demonstrates that animals are capable of re-evaluating their experiences when they are not in the midst of them."

Because a dog's brain is more complex than a rat's, that's a good indication that dogs dream, too.

Does breed matter?

sleeping springer spaniel A springer spaniel might dream about flushing out an imaginary bird while he sleeps. (Photo: Adya/Shutterstock)

Dogs likely dream about what they know, says Psychology Today columnist Stanley Coren, author of several canine books including "Do Dogs Dream? Nearly Everything Your Dog Wants You to Know."

Coren describes a study where researchers inactivated the part of the brain in dogs that keeps them from acting out their dreams. During the part of sleep when the dogs were most likely to dream, they began to move around and performed the actions they were doing in their dreams.

"Thus researchers found that a dreaming pointer may immediately start searching for game and may even go on point, a sleeping Springer Spaniel may flush an imaginary bird in his dreams, while a dreaming Doberman [pinscher] may pick a fight with a dream burglar," Coren writes.

When dreaming starts

A dog typically hits REM sleep about 20 minutes after he falls asleep, says Coren. That's when breathing becomes shallow and irregular and he may start twitching and making noises. You may even notice his eyes moving beneath his closed eyelids.

"The eyes are moving because the dog is actually looking at the dream images as if they were real images of the world," Coren writes.

For some reason, the size of the dog seems to determine the size of the dream, Coren told Live Science. Smaller dogs dream more often, but have shorter dreams, he said, while larger dogs have longer dreams, but don't dream as frequently as their more diminutive canine counterparts.

Other sleep issues

If dogs dream, there's also a good chance they have nightmares. (You've run out of treats! You're going on a walk without him!) In fact, dog sleep is a lot like human sleep in many ways, Coren says. For example, dogs can get narcolepsy, a sleep disorder where the brain can't regulate sleep-wake cycles like it should so sleep comes on suddenly and instantly, often in the middle of the day.

One condition dogs rarely have that's a big problem for people is sleep deprivation, says Coren.

"You give a dog an opportunity, and he lies down and he closes his eyes."

Mary Jo DiLonardo Mary Jo writes about everything from health to parenting — and anything that helps explain why her dog does what he does.