"My dear Elinor, you were obviously born into the wrong story,” said Dustfinger at last.
Metafiction is a device that involves characters who acknowledge the roles and tropes of storytelling to various degrees. It also can be invoked by setting stories inside each other.
One of the better-known examples of metafiction is The Princess Bride, both the film and book versions. The book is even more of a mindscrew than the movie, as the narrator elaborates on how his father used to read the book to him as a child, and the struggles he went through to abridge the book and so on. The movie is set up in a similar fashion, with the grandfather interjecting occasional comments such as "she doesn't get eaten by the shark at this time." If you haven't seen the movie, I won't spoil it for you--just go and see it!
Another story with metafictional elements is the Inkworld trilogy by Cornelia Funke. The first novel, Inkworld, has been adapted into a mediocre film, but the books are better. Meggie lives with her bookbinder father when a strange man named Dustfinger appears outside their home, warning them about someone named Capricon. It turns out that Meggie's dad can read characters out of books, but at a cost--something--or someone--from our world must return to replace them. Not only does each chapter open with quotes, but there are several shout-outs to other works, such as main characters exchanging notes in in Elvish runes.
Finally, the Thursday Next series is one of the most hilarious books I've ever read. The main character develops the ability to jump in and out of fictional realms, from Jane Eyre to Great Expectations, but that's just the beginning. There are also dodos, Neanderthals, time travel, and maps of the Bookworld, with tons of shoutouts.