Pisanio plays musical chairs when it comes to whose servant he is. He's technically Posthumus's man, but he gets passed along to Imogen and the Queen throughout the course of the play. That doesn't change his real allegiance, though: he's as loyal as they come.
When the Queen asks Pisanio to help her, he tells the audience, "[W]hen to my good lord I prove untrue, I'll choke myself" (1.5.99-100). Message loud and clear: he won't betray Posthumus, no matter what anyone—even the Queen—has to say about it.
Pisanio doesn't stop there. When Posthumus accuses Imogen of adultery and orders Pisanio to kill her, he's totally conflicted. On the one hand, he wants to obey his master's command. On the other, he knows that Imogen is innocent. So what does he do? He comes up with a plan of his own. He tells Imogen, "I'll wake mine eyeballs out first" before killing her (3.4.111). Ouch.
Pisanio figures out there is a villain at work. While Imogen and Posthumus are busy blaming each other, Pisanio sees what's really going on. He tells his mistress, "[S]ome villain, ay, and singular in his art, hath done you both this cursed injury" (3.4.137-139). Boy, is he right.
Now, we know that Iachimo has had his ugly mitts around here, wreaking havoc and tearing the lovers apart. Aside from the audience, the only people who know this are far, far away, in Rome to be exact. Based on fairly little evidence, Pisanio figures out that something must be happening for Posthumus to think so poorly of his wife. He's a regular Sherlock Holmes.
Pisanio's detective work and his plan to make things right between Imogen and Posthumus show how much he really cares about them. He's more than a loyal servant: he's a friend, confidant, and helper to them both. He recognizes Imogen when even her father and husband do not. When she's disguised as Fidele, Pisanio tells the audience, "[I]t is my mistress" (5.5.152). He doesn't just obey theses two; he loves them and wants them to be happy.
When Posthumus says that "every good servant doe not all commands" before heading into battle, he's reprimanding Pisanio (in his mind) (5.1.6). Actually, Pisanio has done exactly that: he seems to understand the difference between what he's told to do and what he should do. Whether it's the Queen or Posthumus giving him an order he disagrees with, he figures out a way to do the right thing.
Why is Pisanio able to see through everyone's deception when all the rest are fooled? Well, for one thing, he seems to truly love his master, Posthumus, and his master's wife, Imogen. His perception isn't compromised by romance or hot bods: he can see people as they are, probably because he's a decent guy who legitimately cares about other people.
He's not a total innocent, like Guiderius and Arviragus: he knows the court well enough to understand all the deception that goes on there, but he keeps himself outside of it. It's lucky he's such a good guy—this play could easily have turned into a tragedy without him.