The Messenger of Allah ﷺ said, "The time for the Maghrib prayer lasts as long as the twilight has not disappeared..." the rest of the hadith.
قال رسول الله ﷺ: ووقت صلاة المغرب ما لم يغب الشفق… الحديث.
Muslim narrated it in "The Mosques" (612:173) from Ahmad bin Ibrahim Dawraqi, who said, Abdul-Samad narrated to us, who said, Hammam narrated to us, who said, Qatada narrated from Abu Ayub, from Abdullah bin Amr, and he mentioned it in a long hadith.