David Chase was in therapy for many years, and he admittedly used that experience to portray and write the scenes between Tony and Dr. Melfi. There is a one-hour long interview with him after the first season ended, and I highly recommend it once you finish the whole show.
Tony blames therapy over and over again when something goes bad in his life, and always emphasizes that it’s pointless and doesn’t work — which is never true. Even though he despises therapy, it helps him to deal with panic attacks and many other issues in his life with family, kids, and “colleagues.”
I’m currently re-watching the last season (it’s one of my favorites), and it’s unbelievably poignant and accurate almost every minute of it. Men identify with Tony so easily because he struggles with issues we all do throughout our lives. That’s one reason why The Sopranos is one of the best TV shows ever, and it can be hardly beaten. It was and is groundbreaking — even 20 years later.