Agonists to the μ-opioid G protein-coupled receptor (μOR) can alleviate pain through activation of G protein signaling, but they can also induce β-arrestin activation, leading to such side effects as respiratory depression. Biased ligands to μOR that induce G protein signaling without inducing β-arrestin signaling can alleviate pain while reducing side effects. However, the mechanism for stimulating β-arrestin signaling is not known, making it difficult to design optimum biased ligands. We use extensive molecular dynamics simulations to determine three-dimensional (3D) structures of activated β-arrestin2 stabilized by phosphorylated μOR bound to the morphine and D-Ala2,N-MePhe4, Gly-ol]-enkephalin (DAMGO) nonbiased agonists and to the TRV130 biased agonist. For nonbiased agonists, we find that the β-arrestin2 couples to the phosphorylated μOR by forming strong polar interactions with intracellular loop 2 (ICL2) and either the ICL3 or cytoplasmic region of transmembrane (TM6). Strikingly, Gi protein makes identical strong bonds with these same ICLs. Thus, the Gi protein and β-arrestin2 compete for the same binding site even though their recruitment leads to much different outcomes. On the other hand, we find that TRV130 has a greater tendency to bind the extracellular portion of TM2 and TM3, which repositions TM6 in the cytoplasmic region of μOR, hindering β-arrestin2 from making polar anchors to the ICL3 or to the cytosolic end of TM6. This dramatically reduces the affinity between μOR and β-arrestin2.