The reason why players choose to rest too often is obvious. If the way the game is set up 4 encounters are assumed to drain the PCs' resources, then logically the 1st encounter the PCs will be at full strength and the encounter will be easy, the second they'll be at 3/4 strength and the encounter will be moderate, the 3rd they'll be at 1/2 strength and the encounter will be hard, and the 4th they'll be at 1/4 strength and the encounter will be very hard with a real possibility of defeat. Players who choose to rest after 2 encounters aren't doing so because those first 2 were too hard, they're doing so because they're trying to game the system -- they don't ever want to face hard encounters where they've got 1/2 or 1/4 of their resources, they want everything to be easy encounters where they're at full or 3/4 strength. And, barring other considerations, that's a perfectly reasonable and tactically sound approach, so the DM has to react by doing one of two things: 1) make sure there are other considerations that make frequent resting a less attractive option (the kinds of stuff mentioned in this thread -- wandering monster checks, the bad guys becoming more organized (i.e. the challenges becoming tougher) while the party's away, etc.), or 2) accept the fact that the party is going to rest after every encounter and bump encounter difficulty accordingly, so that instead of every encounter being designed to use up 1/4 of the party's resources it's indtead designed to use up all of them, or at least 3/4. The players are trying to game the system to their advantage, so it's perfectly appropriate for the DM to game it right back at them (assuming, that is, that the DM wants the adventure to have some element of difficulty for the players, some realistic risk of failure, and that success should be determined by player skill (and/or luck) and not a foregone conclusion due to statistical inevitability -- if not, if you don't care if the deck is stacked in the PCs' favor, then why make them rest at all? -- just declare by fiat that all character resources (spells, hp, etc.) are fully restored after each encounter, so the party will always be at full strength -- the end result will be the same but you won't have slowed the game down with boring minutiae).
Oh, and FWIW my suggestion that the DM forbid players from returning to the dungeon and/or threaten to quit was at least partially tongue-in-cheek (hence the winking smiley). In reality, I concur with Hussar's advice -- if you know that your players are going to be likely to leave/rest mid-session and then want to continue, you should plan ahead and pre-determine how the dungeon is likely to change based on PC activity -- "if a group attacks, leaves, and returns with 7 days they'll find increased patrols (double wandering monster checks), guards are more wary (1/2 normal surprise chance), and 1/3 of the reserve squads from areas 8-13 will be moved up to reinforce areas 2-7; if possible barricades will be set up in area 4 and/or ambushes set in areas 5 and 6" or something like that; it doesn't really take much time/effort and you'll have a short break while the PCs are resting (choosing their new spells, calculating how many hp they got back, etc.) to adjust and expand these notes based on the actual, rather than theoretical, way things played out.
Oh, and one last thing, in the original game (and 1E AD&D) combat rounds were a minute each (and the total time of each combat was rounded up to the next 10 minutes) and parties were also forced to rest 10 minutes out of every hour while exploring dungeons. Add to that the (not universal but widespread) phenomenon of combat in those systems taking less time to play out than the current one, and you've got a much closer correlation of real-time to game-time -- instead of 4 combats taking 3 hours to play out and 3 minutes of game-time, it'll be more like 2 hours to play out and an hour of game-time.
Oh, and FWIW my suggestion that the DM forbid players from returning to the dungeon and/or threaten to quit was at least partially tongue-in-cheek (hence the winking smiley). In reality, I concur with Hussar's advice -- if you know that your players are going to be likely to leave/rest mid-session and then want to continue, you should plan ahead and pre-determine how the dungeon is likely to change based on PC activity -- "if a group attacks, leaves, and returns with 7 days they'll find increased patrols (double wandering monster checks), guards are more wary (1/2 normal surprise chance), and 1/3 of the reserve squads from areas 8-13 will be moved up to reinforce areas 2-7; if possible barricades will be set up in area 4 and/or ambushes set in areas 5 and 6" or something like that; it doesn't really take much time/effort and you'll have a short break while the PCs are resting (choosing their new spells, calculating how many hp they got back, etc.) to adjust and expand these notes based on the actual, rather than theoretical, way things played out.
Oh, and one last thing, in the original game (and 1E AD&D) combat rounds were a minute each (and the total time of each combat was rounded up to the next 10 minutes) and parties were also forced to rest 10 minutes out of every hour while exploring dungeons. Add to that the (not universal but widespread) phenomenon of combat in those systems taking less time to play out than the current one, and you've got a much closer correlation of real-time to game-time -- instead of 4 combats taking 3 hours to play out and 3 minutes of game-time, it'll be more like 2 hours to play out and an hour of game-time.