(This is a post I just made in the WotC boards in answer to question, I thought it merited a thread over here too, since people here usually have good ideas that have improved my game by leaps and bounds these past few weeks... so consider this a "feedback and ideas welcome" kind of thing
)
***
This is what I do to get around this stuff. It's a little meta-game-y, but my players all grew up playing stuff like Baldur's Gate and Final Fantasy so it's pretty much the way they expect it to work.
Basically what I do is give them quests. They look in the wanted posters, a few people are offering jobs (I prep about three of these for every game session), they go talk to the person that interests them the most, and she tells them what the quest is, and what reward she's offering.
The thing is, I always try to make the quest something time-sensitive. Examples... one time they had to hunt down a fleeing assassin through a forest, another time they had to find a rogue who had stolen an amulet that controls the iron golem that defends the town, another time they had to retreive the skull of a lich before a warlock that sought it managed to summon it. Stuff like that. Very "This is your mission should you choose to accept it" kinda stuff.
Now, each "quest" is 3, 4, or 5 encounters long. Each quest is actually a "day" in game terms. And, just like a party short-rests automatically after finishing an encounter, they also long-rest automatically after finishing a quest. They know through previous agreement that they cannot long-rest in the middle of a quest, because of a quest's time-sensitive nature.
Also, I've made it clear through just talking before with the players, that once you start a quest, that's it; if you decide to leave in the middle, well, you fail the quest. The assassin would get away, the rogue would attack the city with her new golem, the warlock would complete his lich-summon ritual. You can either see the quest through to the end and receive the bonus reward for completing it, or you can go in, take what XP and treasure you can, and skip out, miss out on the bonus XP and rewards, and the world will go through the consequences of you having failed the quest. They can go back to the same dungeon again, but now the opportunity has passed and whatever quest or event was going to happen there is lost.
This can actually not be a bad thing, for instance, if the warlock succeeds in summoning his lich? Well, now there's a lich loose in the world doing all kinds of mayhem, and that just serves as an excuse for many new quests to go on in the future (this is actually the situation in our game right now). So it's a balance between success and failures, with the failures giving rise to more opportunities for success.
Another thing that can happen is that they decide to abadon the quest and go for something else. For example, in the "rogue who stole the golem's amulet" quest, at the last minute I had the rogue offer the party that if they let her go and pretended they had killed her, she would be in their debt, and she would put her new golem at their service, and they could use it every now and again to help them in tough fights. They actually agreed to that!! And so they failed the quest - but now they have a strong and grateful ally they can seek help from sometimes.
Anyway, the point is that from the point that the party becomes aware of a certain dungeon or temple or whatever, there's a certain "bonus" to completing it in one shot. They can either follow through and succeed in what they need to do and be heroes, or they can be cowardly/selfish and retreat to lick their wounds and see what happens.
This has worked very well for us, nowadays I don't even think of this type of problem any more, cause it's taken care of. But like I say, this has a video-game-y feel to it and it might not be to some people's tastes. It depends on how much simulation or realism you want in your game.

***
This is what I do to get around this stuff. It's a little meta-game-y, but my players all grew up playing stuff like Baldur's Gate and Final Fantasy so it's pretty much the way they expect it to work.
Basically what I do is give them quests. They look in the wanted posters, a few people are offering jobs (I prep about three of these for every game session), they go talk to the person that interests them the most, and she tells them what the quest is, and what reward she's offering.
The thing is, I always try to make the quest something time-sensitive. Examples... one time they had to hunt down a fleeing assassin through a forest, another time they had to find a rogue who had stolen an amulet that controls the iron golem that defends the town, another time they had to retreive the skull of a lich before a warlock that sought it managed to summon it. Stuff like that. Very "This is your mission should you choose to accept it" kinda stuff.
Now, each "quest" is 3, 4, or 5 encounters long. Each quest is actually a "day" in game terms. And, just like a party short-rests automatically after finishing an encounter, they also long-rest automatically after finishing a quest. They know through previous agreement that they cannot long-rest in the middle of a quest, because of a quest's time-sensitive nature.
Also, I've made it clear through just talking before with the players, that once you start a quest, that's it; if you decide to leave in the middle, well, you fail the quest. The assassin would get away, the rogue would attack the city with her new golem, the warlock would complete his lich-summon ritual. You can either see the quest through to the end and receive the bonus reward for completing it, or you can go in, take what XP and treasure you can, and skip out, miss out on the bonus XP and rewards, and the world will go through the consequences of you having failed the quest. They can go back to the same dungeon again, but now the opportunity has passed and whatever quest or event was going to happen there is lost.
This can actually not be a bad thing, for instance, if the warlock succeeds in summoning his lich? Well, now there's a lich loose in the world doing all kinds of mayhem, and that just serves as an excuse for many new quests to go on in the future (this is actually the situation in our game right now). So it's a balance between success and failures, with the failures giving rise to more opportunities for success.
Another thing that can happen is that they decide to abadon the quest and go for something else. For example, in the "rogue who stole the golem's amulet" quest, at the last minute I had the rogue offer the party that if they let her go and pretended they had killed her, she would be in their debt, and she would put her new golem at their service, and they could use it every now and again to help them in tough fights. They actually agreed to that!! And so they failed the quest - but now they have a strong and grateful ally they can seek help from sometimes.
Anyway, the point is that from the point that the party becomes aware of a certain dungeon or temple or whatever, there's a certain "bonus" to completing it in one shot. They can either follow through and succeed in what they need to do and be heroes, or they can be cowardly/selfish and retreat to lick their wounds and see what happens.
This has worked very well for us, nowadays I don't even think of this type of problem any more, cause it's taken care of. But like I say, this has a video-game-y feel to it and it might not be to some people's tastes. It depends on how much simulation or realism you want in your game.