In a time when almost everyone shares almost everything, the question of boundaries between a doctor and patient is thornier than ever.

Beyond the obvious no-go areas of sex and abuse, the relationship can be fraught. How do you reply to the chatty doctor who name-drops other patients—including your co-workers? Can you invite your dermatologist to dinner?

Doctors are divided on how strict the boundaries should be. Some have firm rules against socializing with patients or revealing personal details about their own lives. Others say a closer relationship can build trust and make it more likely patients will follow medical advice. The growth of social media complicates things, too, especially as a generational shift means young digital natives are entering the medical profession.

Before, “you would see your patients in the hospital, or you’d see them in your clinic or, maybe, at a party,” says Sigal Klipstein, the chair of the ethics committee at the American College of Obstetricians and Gynecologists. “Now you can reach out to your patient and your patient can reach out to you in a lot more pathways.” Dr. Klipstein doesn't accept Facebook requests from patients on her personal page. And while she’s sometimes invited to christenings for patients’ babies, she doesn't attend.

Wayne J. Riley, president of the American College of Physicians, says doctors should “adopt a posture of warm detachment,” with their patients.

Click for more from The Wall Street Journal.