How did dogs develop into pets?
Dogs were one of the oldest animals to be domesticated, where they likely were domesticated by at least 15,000 years ago. This shows they have played an important role in the history of human societies. While dogs became domesticated relatively early in complex human societies, their history as pets is generally less clear.
Early Use of Dogs
Dogs were most likely domesticated in the Middle East, Central Asia, or even China. While it is well known that dogs originated from wolves, as they are still able to mate, indicating their close genetic affiliation, it is not clear which type of wolf may have led to their domestication. One idea is that the Siberian, Eurasian, or Middle East grey wolf or their relatives, although not necessarily a direct ancestor of modern wolves, may have been the first wolf to be domesticated into dogs. In any case, there may have been multiple regions spanning Eurasia where domestication occurred. This suggests that their utility different in the various regions in which dogs were domesticated. The initial use of dogs varied as guard animals or even as a food supply. The fact that they were likely domesticated before agriculture became present in most places also suggests their role in hunting may have been important. In fact, some of the oldest known breeds, such as the Basenji, appear to be related to hunting and possibly guarding, suggesting that most early domestication of dogs favored this specific role. 
While wolves are known as hunters, the reality is they also spend a lot of time scavenging. It is this scavenging behavior that likely brought them close to human encampments. This would suggest that human populations likely noticed a potential symbiotic relationship, where wolf-like dogs could eventually provide protection and help in hunting. Initially, wolves would have been likely seen as a threat, but studies have shown that wolves can be relatively quickly tamed. Within one generation, a wolf born can be more tame and within a few generations wolves can begin to loose their wolf-like qualities (e.g., pointy ears) and begin to be tightly integrated into human societies and even within placed within the house.
In East Asia and possibly other regions, dogs as sacrificial animals as well as for their utility in food developed more closely. Very likely dogs were consumed in other regions, but over time many regions stopped using dogs as main food sources.
Dogs as Pets
As wolves-dogs were increasingly utilized for hunting and protection near human camps or eventually settlements, their utility expanded even more with the onset of agriculture. By then, protecting crops and domesticated animals (e.g., sheep and goats) from other humans and animals became an import function. Given that speed, ability to quickly identify threats, and be able to fight back were desirable traits for protection, this made dogs ideal for roles in agricultural societies. However, if dogs were only aggressive, this would mean they could be a threat to the inhabitants of settlements. Thus, what likely occurred is that dogs were trained to identify those they are linked with, through their day-to-day contact, and those who have little connection to them. This made dogs, as they evolved, become better able to differentiate different people and threats. While in the encampment or settlement, the evolving dogs had to be trained for more docile actions. This likely made them more friendly and easier to control. In fact, in nature, wolves have been found to be among the most gregarious animals and they show a high degree of cooperative traits compared to many animals (e.g., their ability to hunt together in packs requires cooperative behavior). These traits likely helped them develop into more friendly breeds, while still retaining characteristics for protection and hunting.
By historical periods, over 5000 years ago, dogs begin to be shown as more pet-like animals. In ancient Mesopotamia, the goddess Innana was shown as having seven dogs accompanying her. In fact, from Mesopotamia or perhaps Egypt, the first depictions of a dog collar are shown. Dogs were also discussed in various ancient mythology in Mesopotamia, where they served as companions and provided a protective guard. In Egypt, dogs were kept as pets. In fact, with military conflict becoming the norm among early states, we also see dogs serving in the armed forces of countries, presumably as aggressive animals that can protect or attack an enemy. The Egyptian god Anubis', although often shown as a jackal, temples had dog mummified burials, suggesting that dogs also were seen as having an afterlife (Figure 1).
In ancient Greece and Rome, dogs have been shown as pets and having a close relationship with their owners (Figure 2). It appears from depictions that dogs make up the most common or among the most common type of pet, while hunting and guarding were still important functions for dogs in these societies. Literature from these societies discuss how dogs would eat from their master's table and the literature discusses the close relationship that dogs formed with humans. It was during the Classical period that likely varieties were developed for their more common household use, such as the small Melitaean dog. Dogs were even buried with masters. There could have been religious function for this, but it also likely reflects that close relationships developed by then.
Current Global Use
Global use of dogs indicates that many societies see their functions differently. In parts of the world, protection still forms among the most important roles. However, in the West and some affluent Asian states, dogs are mainly seen as pets, although at times they are used in hunting and protection. In the last few hundred years, sometime likely after the Middle Ages, new breeds such as poodles and others that were selected for their looks in particular became more common. This concept of ornamental dogs originated in Western Europe. Cats likely makeup the most common pet in many European and North American societies today. In Africa, South America, the Middle East, and parts of east Asia they are mainly seen as guard animals. In east Asia, dogs are also seen as a food source and in some places are among the most common types of meat eaten.
However, increasing influence of Western culture is beginning to affect more affluent classes even in countries that have traditionally not kept dogs as pets. For instance, in China, India, South America, and Africa, ownership of dogs as pets has increased dramatically. Nevertheless, this has created problems, as many dogs that have been domesticated to have more pet-like qualities are not always well adapted to live in some countries' climates and environment. This could eventually lead to new breeds or selective types of breeds for some locations, particularly very hot countries where many dogs are not well adapted to live.
Dogs have had among the longest histories with humans. This is because they are, in nature, not very large, show a gregarious attitude, and display cooperative traits. However, they are also aggressive and run very fast. These qualities likely made dogs useful in hunting, protection, and even warfare. Over time, their presence in camps and settlements evolved them into pets. In some societies, they were held as holy creatures or at least worthy of an afterlife. In effect, this shows their importance to humans as dogs played an even more important role during the development of agriculture. Interestingly, relatively few societies, even in ancient periods, used dogs as food, indicating that their various traits made them too useful for consumption. Their friendly nature exists in the wild but was likely selected for in a variety of breeds to allow them to easily co-exist in societies. Such traits have helped them to be among the most common pets today.
- For more on dog domestication, see: Larson, G., Karlsson, E.K., Perri, A., Webster, M.T., et al. (2012) Rethinking dog domestication by integrating genetics, archeology, and biogeography. Proceedings of the National Academy of Sciences. [Online] 109 (23), 8878–8883. Available from: doi:10.1073/pnas.1203005109.
- For more on wolf qualities useful for dogs, see: James Serpell (ed.) (1995) The domestic dog: its evolution, behaviour, and interactions with people. Cambridge ; New York, Cambridge University Press.
- For more on the history of dogs used as food and sacrifice, see: Sterckx, R. (2015) Food, sacrifice, and sagehood in early china. Cambridge Univ Press.
- For more on the evolution of pets as dogs, see: Miklósi, Á. (2009) Dog behavior, evolution, and cognition. Oxford Biology. Repr. Oxford, Oxford Univ. Press.
- For more on dogs in ancient Egypt and Mesopotamia, see: Johns, C. (2008) Dogs: history, myth, art. Cambridge, Mass, Harvard University Press, pg. 26.
- For more on dogs in ancient Rome and Greece, see: Ed, J.C.J., M. (2007) An Ancient History of Dogs: Spaniels Through the Ages. J. C. Judah, pg. 37.
- For more on modern dog breeds and what they are used for, see: Wilcox, B. & Walkowicz, C. (1995) Atlas of dog breeds of the world. Neptune City, NJ; Lanham, MD, T.F.H. Publications ; Distributed in the U.S. to the bookstore and library trade by National Book Network.
- For more on dogs as pets around the world, see: https://www.petsecure.com.au/pet-care/a-guide-to-worldwide-pet-ownership/