I've said this in another reblog, but basically it's because they're extremely complementary flavors of insane, that happened to find each other at exactly the right moment.
House is deeply insecure and intensely self loathing, and also a top tier cynic. He doesn't trust sincere emotion from others or himself. He's in constant pain that makes him bitchy as hell, and on top of that he is legitimately a genius and arrogant as shit about it. House is perpetually starved for affection and also absolutely refuses to accept it or show it. He compulsively pushes people away because he feels inherently unlovable, and knows he'll inevitably fuck up and they'll leave him.
And he hates being like this.
Wilson is a perfect foil to this. He is an idealistic people-pleaser who is compulsively kind, in part because he derives his sense of self worth from being useful. He needs to be needed, to the point of self destruction. The reason he's been divorced three times is he gets into relationships with his patients or other people who are at a point in their lives where they need constant support. And then when they recover and aren't dependent on him anymore, he loses interest.
And he hates being like this.
That's why they're perfect for each other. House is someone who will ALWAYS need Wilson, and because of that, Wilson will never abandon House. Wilson's hangups being so significant and transparent give House a kind of relationship security he doesn't get anywhere else. They're a perfect circle of codependency.
But also, they just like each other. Wilson hates himself for being a push over and admires House for never taking shit from anybody. House hates himself for being an unlovable bastard and admires Wilson's emotional intelligence and genuine kindness. They get each other's humor, they have similar interests, they're both brilliant enough in their respective specialties (House's being deductive reasoning, Wilson's being emotional intelligence) to genuinely challenge each other. Wilson's weird enough that he never gets boring to House. House is kind enough under the layers of curmudgeon that Wilson never feels like his efforts are wasted.
House is someone Wilson feels safe showing his bitchy petty side to, not just because House will put up with it, but because House actively needs it. House can't trust genuine emotion, he needs it to be couched in stupid malicious pranks and bickering, that at their heart show a deep understanding of each other, and a willingness to go out of their way for one another. Wilson can vent the negative feelings he bottles up all day on House and knows the nastier he gets with it the more House will love it, because House loves that Wilson is this goody two shoes around everyone else, and only shows this honest, nasty part of himself to House. At one point Wilson honest to god saws part of the way through House's cane so that it snaps while House is walking on it, something I would find frankly WAY over the line, and House genuinely looks fucking delighted about it.
On top of that, they've known each other long enough and are both smart enough to recognize all of this and correctly interpret each other's slightly batshit methods of communicating affection.
One of my favorite ways the show symbolizes this across the whole series is stealing food.
House steals food from people he likes, all the time, and its such a subtle but meaningful bit of background characterization.
On one level, it's House pushing boundaries of politeness in pursuit of the show's main theme, getting past the barriers to honesty posed by politeness and professionalism and societal pressures. He wants to piss people off enough that they stop acting nice and start being honest.
On another level, its him testing relationship boundaries because of his insecurity. He wants proof that they won't reject him even if he's awful- will you let me get away with this?
And on a symbolic level, it's a request for care. Will you feed me? Will you let me be part of your life?
A lot of his most significant interactions with the team involve food. One of the major times Foreman gets one over on House, he caps off the scene by stealing House's french fries, which simultaneously, to him, symbolizes a reversal of roles, that he's surpassed House. And to House, represents him beginning to see Foreman as an equal. The first time he has a conversation with Thirteen that goes beyond professional and they recognize that shared fear of intimacy in one another, he acknowledges that by offering her his potato chips. He lets her steal food from him.
And obviously there's no one he steals food from more often than Wilson. But Wilson takes it a step further, because he recognizes what the food stealing actually means to House. So he does shit like buying food at the hospital cafeteria that he knows House likes. Or conversely, specifically getting stuff he doesn't like to piss him off. He gets worried House isn't eating well, so he lies about being on a diet and starts bringing a healthy lunch to work because he knows House will steal it.
Wilson takes the implicit request for care and reassurance the food stealing represents, and makes it an explicit offer instead. Not only will I let you steal my food, I will buy food specifically for you to steal. He doesn't just tolerate House's issues, he actively makes space in his life for them.
In short, their friends because they admire each other, challenge each other, and fill each other's most unwieldy psychological needs in a way no one else could. They're toxically dependent on one another, and also the healthiest relationship either of them are capable of having.
AND THEN THEY DON'T EVEN FUCKING KISS!!! AHHG