Has anyone ever thought that the reason why Sam gained control of Lucifer before he jumped in the pit? My theory is that Lucifer stopped fighting. Because when he saw all the things the Sam and Dean did together, it reminded him of the life He and Micheal had before his fall. And so he realized in that moment all that he did was wrong. He realized that Humanity did have good inside it. And so he hid himself away inside Sam, because he was ashamed to admit he was wrong. Sam didn’t know that Lucifer had given up and realized that he was upset at what he had done. So he jumped in the cage.
The pain that Sam encountered in the pit was Lucifer’s angry sorrow, and Michael’s rage to being trapped. If anything Michael did the most damage. But the reason Sam kept seeing Lucifer during season 7 was due to him being his enemy the longest. Lucifer wasn’t really in Sam’s head, it was just him going insane from the pain he experienced in hell. What to take from this is that Lucifer had found a reason to find beauty in humanity but it was already too late.