I honestly get a little tired of the noir thing sometimes—not that it's bad, but the classics overshadow newer stuff. The best known is probably Dashiell Hammett's 'The Maltese Falcon', obviously. That whole Sam Spade walk down the foggy streets thing is iconic for a reason, even if the book isn’t exclusively set in SF.
For something modern that uses the city way more specifically, I always recommend Kelli Stanley’s 'City of Dragons'. It’s post-WWII, Chinatown, the whole noir vibe but with this incredibly dense sense of place. You feel the grit of the streets, the politics, the rain. It’s more of a historical mystery, but the shadows and moral ambiguity are pure noir.
If you want a wildcard, check out 'The Late Show' by Michael Connelly. It’s a Renée Ballard book, and while she’s LAPD, a significant chunk of the first novel involves a case that pulls her up to San Francisco. The contrast between the two cities’ atmospheres is actually really cool, and Connelly knows how to write procedural tension.