Sahih Muslim Book 35, Hadith Number 6584.
Chapter : Supplication during the time of trouble.
Ibn Abbas reported that Allah’s Messenger (may peace be upon him) used to supplicate (with these words) and he (uttered these words) at the time of trouble; the rest of the hadith is the same except with this difference that instead of saying: “The Lord of heaven and the earth,” he said: “The Lord of the heaven and that of the earth.”