The Magic Goes Away is a 1978 novella that expanded upon an earlier short story of the same name by Larry Niven. Niven is, of course, best known as a science fiction author and I daresay that he brings at least a little science fiction sensibility to this fantasy tale, which concerns a spellcaster of great power known only as the Warlock. The Warlock is hundreds of years old and possessed of great magical ability. Nevertheless, he notices that his powers wane if he works magic in one part of the world for too long.
Finding this puzzling, he invents a device to measure the presence and flow of mana -- the energy that powers magic -- and soon surmises that mana is in fact a non-renewable resource that is consumed through the casting of spells. This alarms the Warlock, since magic is vital to the functioning of the world. Not only do wizards and their ilk employ it, but so do various governments and organizations. Without magic to aid them, they cannot function as they have for so long. Inevitably, this leads the Warlock, along some companions, on a quest to find a new source of mana that might be tapped in order to stave off the collapse of civilization as they know it.
Given its publication date, it should be apparent that The Magic Goes Away draws heavily from the Energy Crisis for its inspiration. Despite that, I think the central concept of the novella is an intriguing one and Niven is always good at drawing out logical conclusions to problems, even in a magical world such as this one. I'll grant that some might find both the premise and its resolution unsatisfyingly "rationalist," but I enjoyed them. Part of that is that I've grown to appreciate different takes on magic and fantasy than I did even a few months ago. While I wouldn't use Niven's take in my own games, that's not a knock against it by any means. Indeed, I think I appreciate the story more precisely because it's so far to the side of anything I'd do myself.
The Magic Goes Away is a quick read and well worth your time if you can find a copy. Gygax did not include it in Appendix N of the AD&D Dungeon Masters Guide, but it is included in the bibliography of the Moldvay Basic Rules, for what that's worth.