The very first novel written in a recognizable format was Don Quixote. Its sequel features Don Quixote, the book, the author, fans of the book and a fake sequel written by a man who was not the original author, leading to the hero having to track down the Don Quixote from the fake sequel to get him to sign away his rights to the name/concept, in order that the real author can write a real sequel. That makes this apparently postmodern trope older than Shakespeare.
House of Leaves is unique in the fact that it has two fourth walls. The majority of the story lies in The Navidson Record, telling the story of a house with some interesting features. While reading, it's easy to forget that the house doesn't even exist in the context of the novel. (Narrator/Editor Johnny Truant states this in the foreword, but even he eventually forgets this fact). However, there are several asides in the text of the Record to remind the reader that "none of this ever happened." Early on, a paragraph about the Navidson's famous friends is riddled with blanks, as if Zampano had yet to decide which celebrities to fill in the blanks with. Later, in Will's drunken apology letter to Karen, struck out text reveals a list of characters who do not appear in the novel. Finally, both Will and Johnny find and read books titled House of Leaves, which brings up paradoxesperhaps better left unexplored...
The narrator in C.S. Lewis' The Chronicles of Narnia is a sort of self-aware presence, using personal pronouns to refer to the readers and himself.
Mo Willems' Elephant & Piggie books usually has at least one moment per book where Piggie looks directly at the reader and snarks a bit, but We Are in a Book!, does away with it entirely.
At the end of The Illuminatus! Trilogy, the main character realizes that he is merely a fictional character and that the events of the book are just that: events in a book. He then goes on to analyze some of the more mindscrewy aspects of the novel, and to criticize the author for placing more importance on symbolism than on giving the book a satisfying conclusion.
And then there's the Schrodinger's Cat trilogy by one of the same authors (Robert Anton Wilson), in which each novel is a different parallel universe, but features characters who realize they're living in a bad novel and start hopping between the books. The third book is almost entirely novel-hopping.
A Perfect Vacuum by Polish author Stanisław Lem is a book full of reviews of nonexistent books. If that weren't enough, the first book review in the book is a review of the book itself and an explanation of why it can't possibly ever be written. (Well then what are we reading if the book can't be written?)
Thursday Next features a scene where Thursday is about to get intimate with her husband, then suddenly stops and says she can't do it with so many people watching. After Landen reminds her she's not a character in a book, she apologizes and says she's spent too much time in the BookWorld.
And then the book conveniently cuts to a chapter break. These books have so many different meta-levels it can get really confusing. One particularly fine example comes when Emperor Zhark's arrives to talk to Thursday. He makes a grand entrance described in about ninety words, which ends the chapter. The next chapter is titled "Emperor Zhark" and during the conversation, he tells Thursday that he's renegotiated his contract in the BookWorld so that in his series he gets at least one chapter per book with his name in it, two chapters have to end with his arrival, and the first time he appears requires at least eighty words of description. All those conditions have just been fulfilled in the book you're reading, except Zhark's second chapter-ending arrival. He leaves, then pops back in - ending the chapter again - to ask Thursday for a recipe.
In his recent "Under the Dome", on page 802, the narrator (King himself, as usual) is describing the current state of the town, when he mentions that one of the statues at the war memorial is the great grandfather of one of the characters. Immediately after, he notes "I probably don't have to tell you that," not because we know already, but because it's unnecessary and he knows it.
In the classic Locked Room MysteryThe Hollow Man by John Dickson Carr, one chapter consists of Dr. Gideon Fell giving a lecture on Locked Room Mysteries in fiction. When asked what relevance this has to the situation, he replies "Because we're in a detective story, and we don't fool the reader by pretending we're not."
Carr's The Nine Wrong Answers periodically stops to warn the reader that if s/he thinks such-and-such is the case, s/he's wrong.
A kidnapped mindwiped character in the Doc Savage series regains his memories after seeing the previous Doc Savage Magazine on a news-stand.
Simon Hawke's The Reluctant Sorcerer series of short novels features a villain who not only can hear the narrator and snark back, but ends the series himself by stepping out through the fourth wall, buying the author's publishing company, and forcing him to re-write the story so that he wins.
In Spike Milligan's novel Puckoon, Dan Milligan is aware that he's a character in a novel, and frequently talks back to the narration. At one point he wants to know what page of the book the story is up to, so he stops to look down at the bottom of the current page, and then he reports the (correct) page number in the dialogue. If this novel goes into a new edition, the dialogue must be revised to reflect the correct page number.
Kayari does this in chapter four of Twilight Dragon. Apparently the novel is the accounts of her adventures.
Sophie's World is a book about a book (among other things), and contains an example of in-universe Breaking the Fourth Wall, brilliantly written, as its climax.
Anthony Trollope usually wrote in third person omniscient observer voice. However, in one novel, whose title escapes me right now, the narrator entered into the action by commenting on a character directly, 'and I caught him in a fib once'.
Trollope veers from extreme to the next - at one point in Barchester Towers from The Chronicles of Barsetshire he is describing how he has sat and passed time in the titular cathedral and expressed personal enmity to one of the characters, at another he is telling us he needs to pad out the novel by 12 pages.
The picture book Have I Got a Book For You! by Melanie Watts presents a fox salesperson who begs the reader to purchase the book. His sales tactics grow increasingly more desperate. The book ends up with an actual ripped page and the fox says that if you break it, you buy it.
Charlotte Brontë's Jane Eyre is subtitled "An Autobiography", and presented as being Jane's autobiography. Chapter 11 of the first volume begins by acknowledging that it is, in fact, the start of a new chapter in a novel, and encouraging the reader to imagine this in the manner of a scene change in a play.
The later Myth Adventures novels tend to do this, with narrators addressing the reader as a reader, and/or offering shameless plugs for previous books in the series. (Is there an Advertising On The Fourth Wall trope?)
In The Dresden Files, Harry will sometimes directly address the audience, usually while explaining certain principles of magic, or occasionally when he makes an off-color comment.
Have you ever been approached by a grim-looking man, carrying a naked sword with a blade about ten miles long in his hand, in the middle of the night, beneath the stars on the shores of Lake Michigan? If you have, seek professional help.
So I, um, jumped out of the moving car. Don't look at me like that, it seemed like a good idea at the time.
Possibly justified, as the books can be seen as an ongoing diary or memoir.
In L.A. Meyer's series, Bloody Jack Jacky's best friend Amy starts publishing books about Jacky's adventures under the titles of the previous books. This gives Jacky a chance to respond to the more scandalous parts of her life.
The short story "The Van on Atlantic Street" by Desmond Warzel pauses briefly to address the reader and reassure him that he has nothing to fear should he encounter the eponymous van.
Mohsin Hamid's The Reluctant Fundamentalist begins with the reader filling the role of an American man who bumps into the main character in a shop in Pakistan. The reader only knows what's going on from the dialogue of the other character, as there is no description or dialogue for their character. Most of the novel is flashbacks in the form of the protagonist recounting his life from the age of 18 until now, interspersed with returns to the present in order for the protagonist to comment on the apparently mundane occurrences around you.
The authors of Kill Time or Die Trying are also characters in the book, since it is a dramatisation of events they were part of. There is a time period covered by the book in which they had already started writing the book, so the Fourth Wall effectively doesn't exist, since the people involved were all aware that they had become the subject of a book.
Brad: Who is that? James: A girl Douw dated for a while. We can't use her real name, or we'll get sued for what Douw's about to call her.
In A Christmas Carol,Charles Dickens breaks the fourth wall briefly at the beginning to speak directly to the reader, impressing upon them that Jacob Marley was Dead to Begin With, and indeed dead as a door-nail. He even comments that he doesn't know what is particularly deadly about a door-nail, proposing a coffin-nail as a better choice of ironmongery before back-pedaling and stating he will not overrule the wisdom of his ancestors.
In Fatal Terrain by Dale Brown, one of the characters thinks "This stuff only happens in Dale Brown novels."
In Redshirts, the entire premise is that of extras trying to avoid death on starship away missions. It's later revealed that Andrew Dahl realizes he has Plot Armor because he's the main character. To take it further, one of his friends doesn't actually do anything but seems remarkably Genre Savvy and knowledgeable about the universe in general. The author, perhaps?
In T.A. Waters' The Probability Pad (the third book of the Greenwich Village trilogy), the protagonists go to Victorian-era Transylvania where they encounter a Sherlock Holmes clone — who uses his deductive genius to work out that he and his companion are characters in a work of fiction.
The entire plot of the titular book within The Neverending Story is eventually summarized as Bastion's quest to find the door through the fourth wall.
The narration describing the geography of Fantastica is introduced as a pause in the story to talk directly to the audience.
The Woman in the Wall does this in the first few pages, with the narrator directly addressing the reader, then reverts to having a fourth wall for most of the rest of the book.
'Oh Great' Sonic grated, ' We've only just started this adventure, I've no idea of what I'm meant to be doing yet and I've got a sidekick who's going to be talking Martian at me for the whole of the rest of the book.' 'What book?' Tails asked. 'You're too young to understand,' Sonic smoothed hastily.
Zeus Is Dead: A Monstrously Inconvenient Adventure has quotes from fictional in-universe sources at the start of every chapter, but one chapter begins with a quoted conversation between some of the Muses who, mid-conversation, realize the quote is showing up at the start of a chapter, and remark about it as they're being quoted.
In the last two books there is a storyline which many first-time readers tend to skip/skim, as it is a meandering, long-winded narration about a group of starving children fleeing through a desert, told by a girl obsessed with poetry. However, if one reads closely, one finds the girl acknowledging the presence of readers and even actively calling them cowards for wanting to skip her harrowing tale:
'Do not flee us. Do not flee this moment, this scene. Do not confuse dislike and abhorrence with angry denial of truths you do not wish to see. I accept your horror and expect no forgiveness. But if you deny, I name you coward. 'And I have had my fill of cowards.'
[...] Take what you're given And turn away the screwed face. I do not deserve it, no matter how narrow the strand of your private shore. If you will do your best I'll meet your eye. [...]
You has a meta example for those who read books on their Kindle.
"And the Kindle, the Kindle takes the integrity out of reading, which is what the Internet did to porn."
Terra Ignota: Mycroft often addresses his readers directly, mostly under the assumption that they are from centuries in the future and might need parts of his world explained to them, since he can't be sure what has changed. Conveniently, this also provides explanations for 21st-century readers.
Journey to Chaos: Tasio will address the reader from time to time. Sometimes it is to answer questions that he suspects they have and other times to make sure they're paying attention for an important plot point.
In Canto Eight, the narrator asks the reader to consider how horrified Dante was as Virgil began to leave him alone in Hell.
In Canto Nine, the narrator challenges "ye who have undistempered intellects" to uncover the allegorical meaning of Dante's encounter with Medusa.
In Canto Sixteen, the narrator engages in Lampshade Hanging by swearing to his "dear reader" that no matter how unbelievable Geryon seems, he really did go on this adventure.
Dante breaks the fourth wall to justify why he wept upon seeing the damned of Canto Twenty, since their "bodies" were such mutilations of the human image.
"Thou who readest" art briefly told to expect action before the demon-damned chase in Canto Twenty-Two.
Dante explicitly forgives any reader who doesn't believe his account in Canto Twenty-Five is truthful, since he can't believe it.
Breaking the fourth wall only for "those of wit," Dante charges the audience to consider if he wasn't alive or dead in Canto Thirty-Four, what was he?
In Canto Eight, Dante pleads with his audience to see the thinly veiled symbolic significance of the souls in Purgatory turning away from the dusk in the west to face the eastern sky and praise Christ.
In Canto Nine, Dante asks that no one be surprised if the poem's ever-growing subject matter causes the poem itself to use more "art" than may be expected.
In perhaps the most direct and honest address to the readers in the Comedy, the end of Canto Ten includes a disclaimer that one should not dwell on how severe on the punishments of Purgatory, for they are temporary and insignificant in the face of man's debt to God.
Canto 17 bluntly begins with the poet asking, "Ever been in a misty mountain?" Loose translation aside, it sets the scene uniquely.
The narration in Canto Five asks the reader to consider how they would feel if the Comedy was Left Hanging just as the saints of Mercury were to speak, in order to convey Dante's heated anticipation.
The reader is told twice in Canto Ten to pay attention to the narrator's reflection on how different life would be were the planets and stars aligned slightly differently.
Dante's masterfully-crafted comparison between the crossings of the constellations and wheelings of Heaven's spirit-flames is undermined by when he admits to the audience even that image is only a shadow of Paradise.