He kept things in order. He was somehow part of them but separate
Some of the best comedic characters are like that. Van Dyke's Rob Petrie is a normal guy. A bit gullible, perhaps. Eager to serve. But basically like you and me. He just happens to be surrounded by fruitcakes! Poor Cary Grant stumbles through a Hawks film with everything but a lampshade on his head. It's not he who commits the lunacy. It's thrust upon him.
Classic theatre relied on this element. There's a play called AN ITALIAN STRAW HAT. The main character must suffer all forms of insanity for three acts merely to retrieve a missing hat! This is an effective device, which, as has been observed, worked well for Andy Griffith.