In Death Stalker, Hazel d'Ark is essentially the Lancer. Owen Deathstalker is a proud, pampered aristocrat who, despite his impressive warrior training, only ever wanted to be left alone to write boring histories that no one ever reads (his own words, no less.) Hazel is a streetsmart pirate and outlaw, hates "aristos" and the wealthy, priveleged elite of the Empire, and knows the suffering and tragedy that opulence is built on, which Owen has never seen with his own two eyes. The switch? Despite being the main character and, indeed, hero of the story, Owen is much closer to being The Chick then the hero.
Ron from the Harry Potter books fits the definition perfectly. It was a plot point in the first book with the Mirror of Erised. Harry, who lacked ambition and never knew a family other than his abusive aunt and uncle, sees nothing but his parents standing behind him. To contrast, Ron felt crowded as the second youngest of seven kids and dreamed of outshining them all so he sees himself alone holding awards of many kinds.
For a bit of extra symbolism, Ron (short for Rhongomynyad, cutting-spear) was the name of the mythical King Arthur's spear.
In the Myth Adventures books by Robert Asprin, Aahz is the loudmouthed, worldly, cynical Lancer to the quiet, naive hero, Skeeve. The two become more alike as the series goes on.
Commander Vimes from Discworld spins this trope widdershins. He's the protagonist of Watch books, and is the cynical commanding officer of idealistic Hero Carrot. Plus, now that Vimes is Duke of Ankh, he would be Number Two to the king, if Carrot ever decided to actually take the job.
Also as Commander of the Watch and the richest man in the city, Vimes is effectively the second most influential and powerful man in the city, and often plays the Lancer role to the Patrician, though Havelock Vetinari is hardly the traditional hero.
Vimes has his own lancers: depending on the situation, other Watchmen (notably Carrot, Colon and Nobby) and occasionally his wife take turns at it. Angua is probably this most consistently for Vimes, especially in books that don't centre on the Watch. See Monstrous Regiment, for example.
In addition, many other Discworld characters have their own lancers: Colon has Nobby, Carrot has Angua, Rincewind has the Luggage, Granny Weatherwax has Nanny Ogg...
Ponder Stibbons is this to Ridcully. The contrarian Dean can sometimes fill this role, and is now replaced by Dr Hix.
In Animorphs, Marco is Jake's best friend. He shares a distinctly different and darker view; in his more serious moments, he presents alternative — even borderline ruthless — options. He thinks very differently than Jake, which can be useful for filling in blanks, and helps in formulating strategies when Jake has trouble doing so. It should also be mentioned that along with being the cleverest in terms of tactics, he is explicitly stated to be the one who keeps everyone from going insane because the sarcasm, wit, and dumb jokes he uses as his own defensive shields distracts the others from the seriousness and tensions of their often downright suicidal missions, helps lighten the mood, and just generally helps everyone relax.
Unusually for Lancers, Marco doesn't have any interest in being The Hero - when Jake's out of action, Rachel leads the team and Marco serves as her Lancer.
Panther from the Genesis of Shannara books "Armageddon's Children" and "The Elves of Cintra".
In Shannara, anytime a Leah shows up, it's to play this role for the main Ohmsford.
Mudge from the Spellsinger novels is the Lancer for Jon-Tom, being cynical and streetwise enough to counterbalance Jon's idealism, and carefree enough to keep Jon from turning maudlin about his exile in another world. Later in the series, Jon-Tom returns the favor, as his Morality Pet example helps Lovable Rogue Mudge adjust to life as (yikes!) a responsible husband and father.
Lancelot of King Arthur's Court is the original Lancer, both figuratively and literally. He became Arthur's number two immediately after joining and was every bit the socialite that Arthur never could be.
Bigwig from Watership Down is made of this trope, with some of The Big Guy for flavoring. He's unabashedly the foil to Messianic Archetype Hazel, the cynical tough guy acting as a grouchy but loyal second-in-command to the charismatic, idealistic leader.
He does such a good job, that the Big Bad assumes Bigwig is the leader. When Bigwig mentions that he is making his last stand at behest of his chief rabbit, the idea of a rabbit badass enough to boss Bigwig around terrifies the enemy so much they consider giving up their attack. When Bigwig finally fights Woundwort to a standstill, Woundwort is unwilling to face him again even though, had he but known it, Bigwig was totally exhausted and easy meat.
Patroclus of The Iliad fulfils this role to Achilles' The Hero: more thoughtful and level-headed than his best friend, his death is what snaps Achilles out of his proverbial tent.
The Wheel of Time gives us Mat and Perrin both serving as Lancers for Rand, the first contrasted because of his irresponsibility and refusal to accept destiny and the second because of his devotion to one person over the fate of the world.
In Jim Butcher's Codex Alera series, Antillus Maximus (Max) is The Lancer to Gaius Octavian (Tavi). He is a foil to Tavi in that he is Book Dumb, extremely strong with furycrafting and a hardened veteran of the legions, where Tavi none of the above, at least at first.
Sadrao from Black Dogs is The Lancer of their Five-Man Band. He acts as the foil to Lyra's bumbling, naive, bookishness by being a hardened and competent warrior. As the story progresses, Lyra loses these first two qualities and becomes more and more like Sadrao.
Maybeck in Kingdom Keepers. He is more cynical and grounded in contrast to Finn, which in a Disney work is a disadvantage. He also has trouble grasping the DHI's full potential because he's mentally blocked by his high expectations.
Colt Regan: Colt's partner Alex qualifies, as well as his friend Joseph to a certain extent.
In Stephen King's The Dark Tower series, Cuthbert and Alain are the two trusted companions in Roland's original Ka-tet (as told in Wizard and Glass). Being the polar opposite in personality to the serious, driven Roland, Cuthbert appears to be the lancer of the ka-tet and also the companion that Roland reminisces about the most. Alain could have also been a lancer, except that his cerebral personality is more in tune with Roland's no-nonsense demeanor. Eddie Dean (whom Roland states is much like Cuthbert) would become Roland's lancer later in life.
Bean is the lancer to Ender at Battle School in the Ender series, although Orson Scott Card revisits the story in the Ender's Shadow series to give Bean a badass upgrade
In Margaret Atwood's Year of the Flood, Zeb is the initially the lancer and the muscle to Adam One's founder and moral leader role in the God's Gardeners. A schism eventually leads Zeb to break away into a more militant organization along with a large part of the Garderners.
In the medieval epic poem The Song of Roland, Olivier serves as the Lancer to the main character, Roland. They are life-long companions and rivals (though Roland is stronger) and Olivier's clear-headedness and wisdom serve as a foil for Roland's recklessness and pride, his tragic flaws.
In Honor Harrington, Alistair McKeon best fits this trope for Harrington, even though Michelle Henke is Harrington's best friend.note As of A Rising Thunder, Thomas Theisman seems to have taken over this role, after McKeon's death in At All Costs. Andrew LaFollet could also count. Honor considers this dynamic between an exec and a captain (or an admiral and their chief of staff) critical to a good command.
While Merlin is the protagonist of the Safehold series, and Cayleb and Merlin work closely together, Cayleb is typically the one calling the shots and the role of Lancer goes to his wife and co-ruler Sharleyan. It's noted by one character that they were working in near-perfect tandem even before they gained access to Merlin's technology allowing them to communicate over long distances.
Joseph Carrion of the Mediochre Q Seth Series is The Lancer to Mediochre. Where Mediochre is an idealist, a Technical Pacifist and a grand believer in using his brain rather than his body, Joseph is a cynical gunman who is very intelligent but prefers scrapping with whoever Mediochre permits him to over serious thinking. He's also fanatically loyal to Mediochre, above pretty-much all other ethical concerns.
Elim Rawne from the Gaunt's Ghosts series of Warhammer 40k novels by Dan Abnett is very much this to the titular hero Ibram Gaunt.
Coram of Song of the Lioness is a very classic example in that he is Alanna's man-at-arms. Alanna is a Hot-Blooded, heroic, young Knight Errant. Coram is an older, slightly world-weary commoner who acts as a sounding board when she's upset or considering a decision.
In Horatio Hornblower, William Bush serves in this role. He's Hornblower's Number Two in most of the stories—where Hornblower is innovative and liberal-minded, Bush is unimaginative and unquestioning of the harshness they live in as sailors at war. But where Hornblower is irritable and self-loathing, Bush is generous and uncomplicated, and able to see Hornblower as he is. He's also more physically strong and hardy than Hornblower, who is seasick and ungainly.