In the story, the man (a marooned astronaut on an alien planet, perhaps) is living inside a sealed cave. The cave is sentient, and speaks to the man, and even provides food and water.
There's a weird scene where the cave wants to "become pregnant", and the only way for that to happen is for the man to use a knife to rip into a membrane in the cave... but there's danger involved, because the process (as with a black widow spider) involves the death of the one doing the membrane-shredding. The sentient cave somehow overcomes the instinct to kill the man, who has become her friend.
It was a bizarre story, probably from one of those Best Of ...." Books from the old Science Fiction Book Club.