Variations in human infants" attachment behavior are associated with single nucleotide polymorphisms (SNPs) in the oxytocin receptor (OXTR) gene, suggesting a genetic component to infant-mother attachment. However, due to the genetic relatedness of infants and their mothers, it is difficult to separate the genetic effects of infants" OXTR genotype from the environmental effects of mothers" genotype possibly affecting their parental behavior. The apparent functional analogy between child-parent and dog-owner relationship, however, offers a way to disentangle the effects of these factors because pet dogs are not genetically related to their caregivers. In the present study we investigated whether single nucleotide polymorphisms of pet dogs" OXTR gene (-213AG,-94TC,-74CG) and their owners" OXTR gene (rs53576, rs1042778, rs2254298) are associated with components of dog-owner attachment. In order to investigate whether social-environmental effects modulate the potential genetic influence on attachment, dogs and their owners from two different countries (Austria and Hungary, N = 135 in total) were tested in a modified version of the Ainsworth Strange Situation Test (SST) and questionnaires were also used to collect information about owner personality and attachment style. We coded variables related to three components of attachment behavior in dogs: their sensitivity to the separation from and interaction with the owner (Attachment), stress caused by the unfamiliar environment (Anxiety), and their responsiveness to the stranger (Acceptance). We found that (1) dogs" behavior was significantly associated with polymorphisms in both dogs" and owners" OXTR gene, (2) SNPs in dogs" and owners" OXTR gene interactively influenced dog-human relationship, (3) dogs" attachment behavior was affected by the country of origin, and (4) it was related to their owners" personality as well as attachment style. Thus, the present study provides evidence, for the first time, that both genetic variation in the OXTR gene and various aspects of pet dogs" environmental background are associated with their attachment to their human caregivers.