52 reveals that Will Magnus, creator of the Metal Men, is friends with the villainous T.O. Morrow, creator of Red Tornado, since they're both the fathers of artificial intelligence and both have problems with mental disorders. Will visits Morrow in jail and brings him news of the outside world and Morrow appreciates it.
Batman has a hostile friendly rivalry with both Ra's al Ghul and The Joker (usually, in both cases, with the friendly part strictly one-sided on the villain's part). Neither will stop trying to kill Batman, though their attempts are worthy of him and their history.
Half the time, Ra's al-Ghul doesn't want Batman dead; he wants him to marry his daughter and become his heir.
The Joker is an interesting inversion because, from his point of view, this is their friendship. He commits all sorts of horrific and violent acts not because he's trying to cross the Moral Event Horizon but because he views this almost as a game he and Batman play, and it's sometimes portrayed as the only thing he lives for.
The Killing Joke is the defining example: after the Joker commits probably his most evil act in a long career full of them, the graphic novel ends with the Joker finishing a joke that makes Batman laugh, and the two of them laughing together as the police sirens draw closer.
In a Menacing Face-off style Pose, staring each other down: Batman: How are the kids? Joker: Just fine, yours?
A non-Batman (the person) example: in one issue of Robin (1993), the Joker claims that he took a liking to Jason Todd's rougher, more streetwise style...which was why the latter had to die.
One Two-Face story ended with Two-Face waiting for Batman to come take him away after committing a murder. Harvey Dent is one of Bruce's close friends, and one of the few relationships where the Bruce-centric version of their relationship seems more important than the Batman-centric version of the relationship to him.
In another story that tracks a day in the life of Gotham City, Batman stops outside the window of Two-Face's cell at Arkham Asylum to continue a one-move-a-night chess game they're playing.
Batman's relationship with Catwoman has always been inherently less hostile than with the other villains, primarily because she makes him hot under the cowl, and it's more justifiable here as her crimes are usually simple, for-profit theft (often stolen from jerkasses to boot) and very rarely involve directly hurting people.
There's also The Riddler, who considers his rivalry with Batman a game and who, like Catwoman, is generally not harmful enough to warrant being treated as a serious villain. He eventually takes this to its logical conclusion, by going straight and becoming a detective competing with Batman rather than against him - he still gets the buzz of the rivalry, but Batman isn't allowed to punch him anymore.
The Penguin can also be considered this, since he's one of the few sane villains Batman comes across. When he's not committing some sort of crime, he runs a semi-innocent nightclub in Gotham. Batman will occasionally turn to him for information such as rumors flying about the criminal underworld (while in turn begrudgingly allowing the Penguin's operations to continue), and The Penguin will usually treat them as a business deal.
The Flash's Rogues Gallery can be like this, especially during the Wally West era (though, Jay Garrick and his rogues all became friends after their mutual retirements), with such gems as Wally going to a party the Rogues threw for Captain Cold when the latter was released on parole. He crashed at Cold's house once, and one of his best buddies, the Pied Piper, was still kind of playing the Rogue, if for a good cause. The first Icicle (Joar Mahkent) liked Jay Garrick and Barry Allen enough (and disliked his relatives enough) that he left half of his fortune to whoever was the Flash at the time, and when Clifford DeVoe, the Thinker, was about to die, Jay spent the day racing around the world looking for a cure.
In Gothtopia, Batgirl's best friend and ally, Daybreak, is actually her archnemesis, Knightfall. They have no memories of their previous confrontations and think they've first met rescuing a couple.
In Red Hood and the Outlaws, there is a friendship between sidekick Arsenal (Roy Harper) and criminal Killer Croc (Waylon Jones) after the former hit Rock Bottom and tried to commit suicide while fighting Killer Croc. Luckily Killer Croc wisened up to the scheme and called him out on it. In issue #4 Roy mentions Waylon sponsoring him in the Alcoholic Anonymous program.
In All-Star Superman, Luthor spends half an interview complimenting Clark Kent — saying he writes like a poet, for instance. Some of it is backhanded, of course, and he derides Superman in the same sentence. It largely amounts to, "Clark, you're a good guy. Kind, strong, and intelligent, and you might amount to something if Superman wasn't making you look bad."
A lot of lower-level criminals (including Hitman) have this sort of relationship with Superman; it's been repeatedly noted that since Superman is so damn friendly and nice to everyone as long as they don't try to hurt or kill other people, very few non-super criminals dislike him. In one annual collection of short stories, it's made into a gag where a member of a gang of bank robbers' opening question "Why Metropolis?" (of all cities to rob a bank in), is answered, after a long discussion about those assholes in Star City, Keystone City, and Gotham, when Superman catches them and politely hands them over to the police while recommending the Metropolis reform program to get their lives back together: "Because when he catches you, he's not a jerk about it."
Pre-Crisis Superman had this relationship with Bizarro and Ambush Bug (Bizarro was more an Anti-Villain, and Ambush Bug later became even more annoying to Supes by going straight.) In the Post-Crisis days, Mr. Mxyzptlk is his main "friendly enemy."
The Comedian and Moloch of Watchmen. He specifically comments that Moloch is the closest thing he has to a friend. He's known him for decades. He then immediately comments on how sad and pathetic that is. It's not a one-sided friendship either. Moloch is one of the only people who visits the Comedian's grave.
Circe has a plan that involves mind wiping herself and planting herself in Diana's civilian life that works a bit too well as she becomes close friends with Diana before her memories and powers return and she can never quite get over it afterwards, as those memories of their friendship are some of the best from her very long life. In Wonder Woman (2006) her "help" when Diana tries to retire as Wonder Woman is a good reflection of this, though Circe's reaction about a year after regaining her memories was a violent backlash against the humanity she'd temporarily gained.
Diana saves Cheetah's life and that, combined with her growing respect for the Amazon, causes Barbara to trust her and go out of her way to keep others from killing her to pay her back.
Angelo Bend (Angle Man) is rather fond of Donna, and trusts her enough that when he's badly injured by Barbara he goes to her for help, then comes to help when Donna is fighting Doctor Psycho without being asked or invited. He is also careful to drop Donna in places she can easily escape from unharmed when moving her out of his way during heists with his reality folding abilities.