Two brothers share the position of vizier in Cairo: Shams al-Din and his younger brother Nur al-Din. Shams suggests to his brother that they should marry on the same day and consummate their wedding on the same night, so that they will have children born on the same day who can marry each other. They prematurely argue over a prohibitively expensive dowry, and part ways. Later, Shams has a daughter, and Nur a son, Badr al-Din.
Much later, Nur has become a vizier in Basra. On his deathbed, he tells Badr that he has an uncle in Cairo, and writes out his family story, which he gives to Badr. Badr later falls asleep on his father's sepulchre. Along come a genie and an efreet, who notice his handsome face and talk about getting him married. They are aware of Shams' plan for his daughter to marry Nur's son. They transport Badr magically while he sleeps to Cairo, intending to unite him with his cousin, Sit, so they can marry.
The king of Egypt, wanting to marry Sit and being rebuffed, decides to get revenge by forcing her to marry an ugly hunchback. The genie and efreet arrive at the wedding with Badr and tell him to join. the wedding party, promising him whatever gold he needs whenever he reaches into his pocket. The two supernatural creatures join the party and mock the hunchback; later, they trap him on the toilet and convince Badr to go to Sit's room, where Badr and Sit spend the night.
The next morning, they try to return Badr to Basra as soon as wakes up (leaving his clothing behind!), but they are attacked by angels, so only get as far as Damascus.* Landing at the gate of Damascus naked startles the locals, who don't believe his story of magical transport. Stranded in Damascus, Badr is taken in by a sympathetic cook.
Meanwhile, in Cairo, Sit awakens and cannot find Badr. She tells her father, Shams, that she did not sleep with the hunchback but with a handsome young man. She shows her father Badr's turban and clothes. In the clothing is a receipt with Badr's name, which Shams recognizes. Shams is delighted that his long-ago wish has providentially come true.
Sit gives birth to a son, 'Ajib. Ten years later, as a youth in school, 'Ajib is teased for not having a father, and Sit has to tell him the truth. Shams packs up his daughter and grandson and leaves Cairo to look for Badr. They happen to stop in Damascus.
This tale is one of the longest in the 1001 Nights, so I think I may be forgiven if I, once again, emulate Scheherazade and urge you to sleep well, and we will continue the tale tomorrow, O King.
*The illustration is "A street in Damascus" by Arthur Haddon, 1864-1941.