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 the newest book, 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 Sci-FI author Stanislaw 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, a character 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.
The character (who incidentally is called Milligan) also, at one point, complains to Spike Milligan about the poor description of his legs ("I bet you got yourself a good leg writer...").
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 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 The Probability Pad (the third of a trilogy of "psychedelic" SF novels published in the late-1960s), 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 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.