Dr. Lois Krahn has long maintained that dogs should be kept out of the bedroom at night, even though there is little scientific evidence that dogs disrupt sleep and there is plenty of evidence that pet owners ignore the doctors’ orders anyway.

So Krahn, a sleep specialist at Mayo Clinic’s campus in Scottsdale, Ariz., put the question to the test — tracking the length and depth of sleep of 40 people who kept dogs in their bedrooms.

“I wanted to reconcile this conflict between what we tell people to do and what they seem to do,” she said.

She was barking up the right tree. Pet owners with dogs in their bedrooms spent 7.9 hours in bed each night, on average, and 6.7 hours sleeping — matching community norms for sleep length and efficiency, the study showed.

While costing almost nothing, the study could have a big impact on sleep medicine, given that 43 million American homes have dogs, she added. “Many people actually find comfort and a sense of security from sleeping with their pets.”

The study, published in the Mayo Clinic Proceedings, found that sleep quality didn’t vary much by breed — whether an owner had a big Karelian bear dog or a small Chihuahua.

But sleep quality did suffer a bit when owners let dogs actually sleep on their beds.

Not that the dogs minded. The researchers measured the dogs’ sleep quality too, and found they slept well anywhere. Krahn’s conclusion: Owners should at least keep dogs off their beds.

Krahn said that follow-up studies are needed, but added that she’d like to add a new target: cats. Their effect on sleep could be entirely different, she noted.

“You don’t have to worry about a 60 pound cat [in your bed], and you have this wonderful element that cats purr.

“The one downside of a cat,” she added, “is the whole thing about dogs being trained and learning. Whereas cats don’t generally learn to do what their owners want.”