It happens to a lot of writers. A secondary character starts taking over scenes. Soon he’s getting more page time than your main character. You keep telling yourself to dial him back, but that imp on your shoulder says, “But he’s so much fun to write dialogue for.” At that point you need to stop and ask yourself—Why is this character taking over the story? What’s wrong with my main character that I find it so much more fun to write the secondary character? You need to do some story analysis to figure it out.
Start by asking yourself “Does this story problem match the secondary character better than the main character? If so, I would seriously consider switching main characters. If your secondary character is better suited to go through the emotional arc the story problem and plot would put him through, then switch characters. It’s fatal if the story feels like it has been imposed on the main character. Your character won’t be authentic in dealing with a problem that doesn’t affect his character or isn’t something that would put him through an emotional wringer because of his personality. Don’t feel like you are abandoning the character for a better one, even though you are. You’re just saving this character for another story, one better suited to him. Or her.
If you don’t want to change characters, then ask yourself, “Do I prefer the secondary character because my main character is boring?” If that’s the case, then your main character may be too perfect. Give him some flaws and make him human. A character that is all good can’t grow. How do you improve on good? Unless you want him to turn into a god in order to show character growth, you’ve got to start at a lower level. Your character needs room to change.
If you have trouble giving your character a flaw, then take something that seems a positive trait and turn it against him. For example, if your character is highly efficient and plans everything out to the last detail, then put him in a situation where all his planning is for naught and watch how he deals with it. Hint, don’t make him noble and accept it. Have him throw a fit. Lot’s of times authors turn to the secondary characters to throw the fit their main character should. It’s as if they don’t want a smudge of dirt on their hero. But if you don’t throw your hero in the mud occasionally (metaphorically) so he’s not perfect all the time you won’t have the contrast for him to shine against in later scenes.
I remember an old movie called “The Great Race” starring Tony Curtis, Natalie Wood, and Jack Lemon. The movie was set back around the turn of the century and concerned a car race from the US to Paris. Tony Curtis was the good guy, dressed in white, and never got a smudge of dirt on him. His teeth also flashed a sparkle every time he smiled. Blake Edwards took the perfect hero image to the absurd, putting him in situations where he never got a spec of dirt on himself while everyone else was in a mud bath. It’s a very funny movie if you haven’t seen it. However, I would argue that Tony Curtis’ character was not the main character. It was actually Natalie Wood who contrived to enter the race in order to report on it as the first woman journalist. She was the one who came up with a plan and acted on it. She was the one who grew and changed over the course of the movie, and while Tony Curtis did fall in love with her and changed slightly (became more human and less infallible), it was still her story. You can include a perfect character in your story, just don’t make it your main character. And play it for laughs. Above all, don’t hold the character up as one to emulate. There’s no faster way to turn off your reader.
If your main character isn’t too perfect and the story is suited to his personality, then you’ll have to be firm with your secondary character and reined him in. Give him moments to shine where it makes sense in the plot, but cut the scenes where he goes off on a tangent. You’ll need to be ruthless in your analysis. Does this scene move the story forward; is it necessary to the plot; is it funny for the sake of funny, but not really necessary? If the answers to those questions are “no,” “no,” and “yes” then cut the scene. Ultimately, your story and your main character will be the stronger for it.