Trying to pin down the total number of 'Vampire Diaries' books gets messy fast because it depends on how you count them. The core series by L.J. Smith is four books: 'The Awakening', 'The Struggle', 'The Fury', and 'Dark Reunion'. After that, HarperCollins brought in ghostwriters for a second arc, which includes 'The Return: Nightfall', 'The Return: Shadow Souls', and 'The Return: Midnight'.
Then you have the 'Stefan’s Diaries' prequel series, which is six books tracing his life before Mystic Falls. There's also the 'Hunters' trilogy, which follows a new character, and a single 'The Salvation' novel. If we're just talking original continuity, that's the main four, plus the three 'Return' books, plus the six prequels, the three 'Hunters', and the one 'Salvation'—so, seventeen books.
But that's not all! The 'Legacies' trilogy is a separate spin-off focusing on Hope Mikaelson from the TV show universe, not the book universe. So if you include those, you're looking at twenty. Honestly, I lost count halfway through my own explanation. My shelf has the original quartet and the 'Return' trilogy, and I kind of pretend the rest don't exist, but your mileage may vary.