The pair departed the BBC sci-fi drama in 'The Angels Take Manhattan' after being sent back in time by the Weeping Angels, but Moffat revealed that death was another option for their exit.
"So many times over those mad few days [of finishing the script], the fate of the Ponds changed," Moffat wrote in the Radio Times.
"Alive, dead, alive, dead. Everything was wrong. Nothing felt right. Nothing felt inevitable."
Moffat revealed that he only became satisfied with the script when he devised the final scene, which featured a nod to Amy and Rory's debut episode 'The Eleventh Hour'.
"About four o'clock in the morning - with the gaspingly late script promised to the production team in a few hours - I remembered 'The Eleventh Hour'... and the single moment we've been heading for, since the very beginning," he explained.
Copyright: BBCThe showrunner previously revealed to Digital Spy in August that he "completely" rewrote his planned ending for Amy and Rory.
"I completely changed the ending as I was writing it, thinking, 'No, I've got it wrong... I'm on the wrong emphasis'," he explained.
Doctor Who will return to BBC One this Christmas.