No one can ask a dog what it dreamed, so science can't say for sure. What researchers found is that dogs have sleep stages like ours (their sleep EEG "resembled that of human subjects" in a study of 22 dogs), and that rats' brains replay patterns from their waking day during REM sleep, the stage most linked to vivid dreaming in humans.
What happens in a sleeping animal's brain?
Louie and Wilson (2001) recorded many neurons at once in rats' hippocampus while they were awake and later asleep. Firing patterns "reflecting tens of seconds to minutes of behavioral experience" were "reproduced during REM episodes at an equivalent timescale". The authors say this replay may matter for memory and gives a basis for studying "the content of dream states".
A later study (Ji & Wilson, 2007) found coordinated replay of the same waking experience in the visual cortex and the hippocampus, this time during slow-wave sleep.
What about dogs?
Using a non-invasive sleep recording, Kis and colleagues (2014) studied 22 pet dogs and 12 people and found that "dogs' sleep EEG resembled that of human subjects".
In a follow-up (Kis et al., 2017), dogs learned new commands before a three-hour nap. During their REM sleep, theta activity rose after learning, and their performance improved after the nap. A related study linked sleep spindles in non-REM sleep to how well dogs remembered (Iotchev et al., 2017). Sleep seems to help dogs learn, as it helps us; what they experience while it happens is unknown.
Why do cats "act out" their sleep?
In lab cats with deliberate brainstem lesions, the muscle paralysis of REM sleep was lost. Some cats raised their heads and seemed to stare or search, some showed attack-like movements, and four walked (Hendricks et al., 1982). The authors themselves warn that this state "is not simply" normal REM sleep acted out, so it is not proof of what a cat dreams.
So do animals dream?
A 2020 review (Manger & Siegel) concludes only that mammals may have "the potential to experience dream mentation", and that the answer depends on whether dreaming needs REM sleep. A twitching paw tells us an animal is in active sleep; it can't tell us the story.
Questions
Do dogs dream?
Dogs have sleep stages like ours, and their sleep seems to help them learn, but no study can show what, if anything, a dog experiences while asleep.
What do dogs dream about?
Nobody knows. The closest evidence is from rats, whose brains replay patterns from their day during REM sleep (Louie & Wilson, 2001).
Why does my dog twitch in its sleep?
Our sources don't study twitching in pet dogs. REM sleep normally comes with muscle paralysis; lab cats whose paralysis was removed by a brainstem lesion moved during REM sleep (Hendricks et al., 1982).
Sources
Louie, K., & Wilson, M. A. (2001). Temporally structured replay of awake hippocampal ensemble activity during rapid eye movement sleep. Neuron, 29(1), 145–156. https://doi.org/10.1016/S0896-6273(01)00186-6
Ji, D., & Wilson, M. A. (2007). Coordinated memory replay in the visual cortex and hippocampus during sleep. Nature Neuroscience, 10(1), 100–107. https://doi.org/10.1038/nn1825
Hendricks, J. C., Morrison, A. R., & Mann, G. L. (1982). Different behaviors during paradoxical sleep without atonia depend on pontine lesion site. Brain Research, 239(1), 81–105. https://doi.org/10.1016/0006-8993(82)90835-6
Morrison, A. R., Mann, G. L., & Hendricks, J. C. (1981). The relationship of excessive exploratory behavior in wakefulness to paradoxical sleep without atonia. Sleep, 4(3), 247–257. https://europepmc.org/article/MED/7302456
Kis, A., Szakadát, S., Kovács, E., Gácsi, M., Simor, P., Gombos, F., Topál, J., Miklósi, Á., & Bódizs, R. (2014). Development of a non-invasive polysomnography technique for dogs (Canis familiaris). Physiology & Behavior, 130, 149–156. https://doi.org/10.1016/j.physbeh.2014.04.004
Kis, A., Szakadát, S., Gácsi, M., Kovács, E., Simor, P., Török, C., Gombos, F., Bódizs, R., & Topál, J. (2017). The interrelated effect of sleep and learning in dogs (Canis familiaris); an EEG and behavioural study. Scientific Reports, 7, 41873. https://doi.org/10.1038/srep41873
Iotchev, I. B., Kis, A., Bódizs, R., van Luijtelaar, G., & Kubinyi, E. (2017). EEG transients in the sigma range during non-REM sleep predict learning in dogs. Scientific Reports, 7, 12936. https://doi.org/10.1038/s41598-017-13278-3
Manger, P. R., & Siegel, J. M. (2020). Do all mammals dream? Journal of Comparative Neurology, 528(17), 3198–3204. https://doi.org/10.1002/cne.24860