Upon Dean 's request, Death retrieves Sam 's soul from the Cage and returns it to him at the end of the sixth season 's mid-season finale "Appointment in Samarra ''. He gives Sam 's mind a "protective wall '' to prevent any negative effects it might have on him otherwise, but Death also warns him not to scratch at the wall he has built, or his memories from Hell will destroy him. However, Castiel, in an attempt to distract Dean and Bobby while he attempts to enter Purgatory, brings down the wall, ultimately causing Sam to remember his time in Hell. In the season finale, Sam spends much of the episode attempting to recoup his shattered soul, including the memories of his soulless self and tortured self. Once complete, he reawakens, though still struggling with the visions of the Cage that his soul endured.
who brought sam out of lucifer's cage
Death Death