It's tough out there for a good guy. If you look at reviews and Internet comments, villains, antiheroes, and bad-boy protagonists are the most loved characters, while the good guys are considered boring. But I believe that good guys can be just as interesting as bad boys and villains if you do it right, and considering the amount of fan mail I get for my good-boy heroes, I must be doing it right. So, here are some tips:
1) First, you have to love these characters, yourself
You can't expect readers to love a character you, yourself, find boring. If you don't love your good guys or only consider the nice boy to be a foil to the bad boy you find a lot more interesting, then you need to start over and create a character you do love.
2) Put just as much development into the good guys as you put into the bad guys, and make sure that shows on the page
For the cases where the writer doesn't necessarily dislike the good guys, I think laziness might be the culprit. It's easy to assume that a good person is automatically sympathetic, while it takes a lot more work to make a darker character sympathetic. That means that the bad boy or villain gets an extensively developed -- and described -- backstory, usually showing some kind of trauma, loss, or other negative experience that led to the character going bad, while the good guy is just good, for no apparent reason that's given, or else is shown having an idyllic life so that he was always good, without any challenges. So naturally, the bad boy is going to be seen as a lot more interesting and sympathetic. It seems to me that you need just as much explanation for how a truly heroic character became that way. It's not a normal human impulse to rush toward danger or to put other people ahead of oneself. It's also become something of a cliche that good arises out of privilege and evil arises out of hardship, but if you look at the real world, it's often just the opposite. While there are desperate people who turn to doing bad things or who never had good role models, a lot of the bad done in the world today comes from privilege. That's where you get spoiled people who expect the universe to revolve around them and who feel entitled -- that's where the snarky, swaggering "bad boys" often come from. On the other hand, going through hardship can make a person more empathetic and more likely to be able to look out for others. Get wild and crazy and mix it up a little in your fiction instead of going with the cliches. Think about what makes all of your characters tick. Flesh out all your characters, giving them traits, quirks, and flaws. Which brings us to …
3) Remember that good doesn't necessarily mean "perfect"
Even truly good people can have bad days. They can get impatient, lose their temper, be snarky, or get into bad moods. Heroes can have flaws. They might be slobs, eat junk food, be shopaholics, be shy, be disorganized, have tempers, etc., and when they have flaws, they're more interesting and easier to relate to. Good people can also have a sense of humor. They don't have to be humorless killjoys. They can have fun. They can have quotable lines.
4) Show, don't tell
This is one case where that age-old advice really applies. If you tell readers that a character is good and heroic -- and especially if the character considers himself good or heroic -- you'd better follow through in showing that person's actions to be good and heroic. Otherwise, the character looks like a Mary Sue or a hypocrite. In today's culture, a hypocrite may be even more despised than a villain who owns his or her villainy. It works even better not to tell anything at all. Just show the character's actions and let readers draw their own conclusions. Or if you really want to tug on readers' heartstrings, have the other characters put this person down and think the worst of him while you show him being awesome. A good rule of thumb is that what you show should always be better than what you tell, whether you're telling in narrative, through the character's own viewpoint, or through other characters' perspectives.
5) Give them goals
Quite often in fiction, the villain drives the story. The villain's the one with a clear-cut goal, and the hero's goal is mostly to stop the villain. That can make the villain more interesting than the hero because the villain is being proactive and the hero is just being reactive, which seems more passive. Even if the villain's goal is what forces the hero to act in the first place, let the hero be smart and at least a little proactive and come up with a plan for stopping the villain rather than just reacting to each thing the villain does. The hero can also have a positive goal, something he wants to achieve aside from just stopping the villain. For instance, if the villain is a tyrant the hero wants to overthrow, the hero should probably have a plan for what comes next, a vision for the society that will be created.
If you put this much effort into all your characters, it will elevate your story. They say that your hero is only as good as your villain, but I think your villain is only as good as your hero.