Martha interrupts a romantic moment between Rick and Kate when she stops by and asks Castle if he can get Oprah to endorse her new book.
Lars Cross, a sonar technician is beheaded in his own home. Despite getting fired from his job in Turkey, he came home and bought a Porsche 911 and lots of new high-tech toys.
Turns out Lars smuggled Aladdin’s lamp that has the Seal of Solomon on it. It looks like it was stolen from Solomon’s tomb. Castle thinks his newfound wealth was given to him by a genie. Beckett thinks the only magic is that collectors are willing to pay millions of dollars for the lamp.
Castle meets Lindsey Dylan who claims to be a journalist out to write the story of the murder surrounding the stolen antiquities but she keeps disappearing…almost magically. She gives Castle a lead, a person named Al Addin.
Lars partner, Mike says that Lars got double crossed shipping the stolen antiquities back to the US. He also says that a genie was released after they opened the tomb and it’s been ruining his life. Someone financed the operation but they don’t know who.
Castle, Ryan and Esposito follow a lead to a rug shop where they find a dead body rolled up in one of the rugs. The body is still warm. They ask Castle to wait outside where he thinks he sees the genie and runs after it but ends up at a warehouse with Aladdin’s lamp inside. A woman catches him and says she has a dozen more lamps just like it but tries to shoot Castle before Lindsey knocks her out and saves him. Then she disappears once again.
Alexis finds “the genie’s” fingerprints on Castle desk. Her name is Genevieve Sutton, a security expert. When they interrogate her she says a mysterious Mr. X hired Lars to protect Soloman’s tomb from being destroyed or looted. She said she was supposed to protect Lars but was pulled away on a false lead. However she got the license plate # of the truck from the warehouse. She said she counted 12 crates inside before it left. The police find the truck but there are only 11 crates inside.
Turns out when Lars returned to NYC, he shared his find with his former professor, Marian Baker who was obsessed with Solomon’s tomb and Aladdin’s lamp. She was so jealous that he found the lamp that she killed him and his partner in order to get it.
Ryan gets a phone call that Jenny is having the baby but there are complications. The team rushes to the hospital to be there with them. Jenny has an amniotic embolism and the doctors fight to stabilizer. Beckett asks Castle to use any wishes he has for Jenny and the baby.
Jenny pulls through. Ryan tells the group she and their new baby boy are going to be just fine. They name the baby Nicholas Javier Ryan. Group hugs all around.
Kate asks Castle if he’s used up all of his wishes. He says he doesn’t need wishes because he already has everything he could ever wish for. Kate says she feels the same.