dog sleeping
The study determined that having a dog in your room with you while you sleep may improve the quality of your sleep. In this photo, a dog sleeps in the basket of a bicycle during the 5th Lady on Bicycle annual festival at Sokolniki park in Moscow, Aug. 06, 2017. Getty Images

If your four-legged furry friend wanders into your bedroom when you're trying to sleep, should you shoo the creature away or let it stay and sleep in your bedroom? Some dogs have a free pass to their owner’s bedrooms, however, many don’t get to enter for the fear of causing a bad night’s sleep.

According to the American Veterinary Association, currently, over 40 million American households have dogs. Among these households, 63 percent consider their pet dogs as a part of their family. However, many of them still are divided when it comes to having their furry family members sleep with them in the bedroom.

But, there’s a solution to the problem in a new study published this month, which said that having canine companions could actually improve the quality of your sleep. Although, there’s a catch. Letting them sleep in your bedroom is ok, but it doesn’t hold true if your dog is in the bed with you.

A Mayo Clinic study, titled "The Effect of Dogs on Human Sleep in the Home Sleep Environment," published in the September issue of Mayo Clinic Proceedings on Friday, suggested that people might actually sleep better when their dogs are in the bedroom with them, meaning that shooing your furry friends off might not be such a good idea.

The study was based on an examination of 40 people who owned dogs and didn’t suffer from any sleep disorders over the course of five months. They put accelerometers on both the dogs and the owners for seven nights for the study and then determined the results.

"We found that many people actually find comfort and a sense of security from sleeping with their pets," Mayo Clinic sleep medicine specialist Lois Krahn said, reported.

The study found that people had a greater sense of comfort and security when they allowed their dogs to sleep in the bedroom. The study also differentiated between the dog being on the bed or just simply in the bedroom. It found that owners with dogs on their beds suffered from lower sleep quality than normal.

Thus, the study concluded that the sleep benefit extends only when you have your dogs in the bedroom but not in your bed.

"The relationship between people and their pets has changed over time, which is likely why many people, in fact, do sleep with their pets in the bedroom," said Dr. Krahn. "Today, many pet owners are away from their pets for much of the day, so they want to maximize their time with them when they are home. Having them in the bedroom at night is an easy way to do that. And, now, pet owners can find comfort knowing it won’t negatively impact their sleep," Krahn added, according to BABW News.

The researchers also said that it is important to consider the limited sample size on which the study was conducted and also to note that none of the dogs examined were under six months old. Younger puppies have more energy and thus might be problematic if they let into the bedroom at night. Thus, further research is required to understand the association between letting your dog sleep in the bedroom or not.