Speaking of treating yourself as well as you might treat a friend... I found this paper on self-compassion to be very helpful when dealing with self-criticism, guilt and shame:
Self-Compassion: An Alternative Conceptualization of a Healthy Attitude Toward Oneself
Self-Compassion: An Alternative Conceptualization of a Healthy Attitude Toward Oneself
https://pdfs.semanticscholar.org/b357/87b9b21486d00458e85f8b....