Inspector Lestrade is a character type that appears on a ton of detective shows today. He's the somewhat bumbling boss (not that he's really Holmes's boss) who gets frustrated with the hero, who always, always bests him. It's a wonder this guy has a job at all, since the hero detective does all the work for him. We see this during his appearances in the "Empty House," the "Norwood Builder," "Charles Augustus Milverton," and the "Six Napoleons."
Actually, Lestrade does end up getting to take credit for cases that Holmes solves, since Holmes is a fan of staying on the down-low. Lestrade is friendly with Holmes and Watson, but he's not above wanting to beat Holmes once in a while.
"[Y]ou must acknowledge that we have been a little in front of you this time, Mr. Holmes"
"You certainly have the air of something unusual having occurred," said Holmes.
Lestrade laughed loudly.
"You don't like being beaten any more than the rest of us do," said he. (Norwood Builder.114-7)
Unfortunately for Lestrade, he never manages to one-up Holmes in any story. Lestrade and Holmes are clearly rivals, even though they do collaborate on cases, but the rivalry appears good natured for the most part.
So what's Lestrade doing in these stories, if Holmes solves all his cases for him? Well, Lestrade is sort of our Scotland Yard representative. He represents the type of men that were actually police in the 1890s, albeit a bit dimmer. After all, if Lestrade could solve all his own cases, then a private investigator like Holmes would be out of a job.