A new class of patient driven healthcare web applications are emerging to supplement and extend traditional healthcare delivery models and empower patient self-care. Patient-driven healthcare can be characterized as having an increased level of information flow, transparency, customization, collaboration, patient choice and responsibility-taking, as well as quantitative, predictive and preventive aspects. Social networking applications or sites are usually dedicated to fostering interaction between users. Healthcare Social Networking (HSN) sites constitute virtual communities where users connect with each other around common health issues and share relevant health data. HSNs have become very popular and broadly adopted by various medical professionals and patients. The growing use of HSNs has prompted public concerns about the underlying risks that such online data-sharing platforms pose to the privacy and security of Personal Health Information (PHI). This paper presents a set of privacy risks introduced by social networking applications in healthcare scenarios. The main contribution of this paper is the introduction of a privacy preserving framework, PriSN, which seeks to preserve the privacy of sensitive healthcare data of end-user in HSNs. PriSN safeguards a user's privacy by generalizing the contextual PHI collected in the HSN applications and shared with a given end-user's peers. To support multiple levels of granularity in the contextual PHI, the proposed obfuscation procedure establishes an ontological description stating the granularity of object instances.