Do not let the egotistical witness intimidate you. Egotistical witnesses come in three varieties: the expert, the ex with an axe to grind, and the robocop witness who comes to court with all sorts of weapons and accessories strapped to his arm, waist, and legs. These witnesses can make you feel as if you are not doing well. When you ask, "so what is your name?" they retort with something like, "it's James Jones, and your client lied to me" The best thing you can do with this witness is keep your cool. The jury won't like him and won't pay much attention to his non-responsive pontificating. If you retort back, raise your voice, or move to strike his answer, you only lend this witness credibility.
You can ask the exact same question over and over until you get the answer you want, or you can nicely ask, "so was the answer to my question yes." Make sure you chop your questions to this witness to the bare bones. Take for instance: "you saw my client walking down main street, right?" Change it to, you were on a Street? It was Main street? You were looking around? You saw a man? That man was my client? And he was walking?
Short questions allow much less wriggle room and provide training for the witness in the rhythm of short answers.
If the witness continues to do it or insists on mouthy responses, just let him go. In your closing argue that he had an agenda and was acting as much of advocate as you and the prosecutor. Point out that a witness like that cannot be trusted not to shade the truth. Argue that the officer probably approach the investigation with the same single-minded determination to cram the facts through a pre-determined conclusion.
In short, if the witness wants to cover himself in mud, don't jump in and wrestle. Just let him roll around in it.