Rashi (Vayera 18:24 and passim) explains that S'dom was the most important of five cities in its neighborhood, and God was going to destroy all of them. First, though, He told Avraham of His intent to do so, and Avraham bargained with Him to save one or more of the cities. The conversation went like this (as explained by Rashi and in my very loose translation/paraphrase):
Avraham: Will You destroy the righteous with the wicked? Perhaps there are fifty righteous people in the cities. Will You destroy…?
Hashem: If I find fifty righteous people in the cities, I'll spare the cities for their sake.
Avraham: What if the fifty are lacking five? That's nine per city. You, the Righteous One, can combine with those nine to make ten per city!
Hashem: I won't destroy the cities if I find forty-five there.
Avraham: Maybe forty can be found! Save four cities!
Hashem: For the sake of forty, I'll not destroy four cities.
Avraham: Save three cities for thirty righteous people?
Hashem: Okay.
Avraham: Two for twenty?
Hashem: Okay.
Avraham: One for ten?
Hashem: Okay.
And that was the end of the conversation. Avraham already knew that Hashem would save one city for the sake of nine righteous people if He would for the sake of ten: after all, Hashem had agreed to add Himself to nine early in the conversation. And there was no point in asking that eight righteous people should save a city because, after all, eight righteous people — Noach and his family — couldn't save the world from the deluge.
Yet in 19:18–23, Lot asked that he be allowed to go to a city, and the destroying angel replied that, because of that request, he wouldn't destroy that city. (And indeed only four cities are listed in Nitzavim 29:22 as having been destroyed.)
But Lot (with his family) was only four people! Was Avraham wrong to stop at ten — he should have bargained for even four righteous people to save a city? If not, how was Lot able to save the city if Avraham couldn't?
(I know the saved city had fewer sins than the other four, as Rashi explains, but that doesn't explain why Avraham couldn't pray for that less-sinful city in the merit of four righteous people.)