It's not easy. We all know that. The balance can be hard to maintain. When I was a greener writer, I tended to lean more to the This Is The Most Awesome Story Ever It's Perfect side. Now I tend to lean towards All My Books Suck I Am An Idiot For Trying To Write. And it seems like it's very easy for a writer to focus all on the Critic and not on the Fan.
You really do need both.
It might sound strange, but it's okay to be confident in your work. I mean, even if you would never say it out loud, you secretly are, right? Deep down, you believe that the story you are telling is special and worth it and you want to share it. Maybe you even think it'll be BIG. Those thoughts aren't bad, cocky, whatever—they are necessary. Again, having confidence is NOT wrong. Now, if it turns into laurel-resting, bragging, and pride, it can be just as bad as going all critic on yourself, but confidence alone is good and essential to your progress as a writer.
Confidence keeps you going, keeps you trying, keeps you enjoying. And when tempered with that inner critic, it becomes a beautiful partnership that produces good work.
It can be hard to stay confident in yourself and you work. There are so many things out there waiting to tear it down—comparison being the most prevalent. But we have to remember that another's skill (or lack thereof) has no bearing on our work. There is room for everyone, and one person's success does not mean your failure.
The other heavy hitter would be criticism, especially when your own critic takes over. It's easy, for some reason, to translate one bad remark as meaning everything you write is bad and will never be good and you should give up now.
This is where the confidence needs to come in—to fight this stuff. The confident part of yourself can tell you that your work has merit, even when others are "more" amazing. The confident part of yourself can bring you back from criticism, tell you that the problems are fixable and it doesn't mean you aren't talented.
If you've been in self-critical mode for too long, it can be hard to find that confidence again. You may have to dig down deep and pull it out. Honestly? When I'm getting all doubtful I ask my friends straight up to compliment me, because sometimes I just need to hear someone else say it, even if it's at request. I also try to go back to the roots of my stories, my love list, and remember why I believed in this story and my ability to tell it in the first place.
So own that confidence, and be proud of your work.