The first published book about Middle-earth written by J.R.R. Tolkien was The Hobbit.
Published in 1937, The Hobbit introduced readers to a fictional world that Tolkien later connected more extensively to the histories of Middle-earth. Its central character is Bilbo Baggins, who leaves the Shire with Gandalf and Thorin Oakenshield’s company to reclaim treasure from Smaug.
The book’s tone and structure differ from The Lord of the Rings. It began as a children’s adventure, uses a more direct narrative voice, and originally presented the discovery of the Ring differently from the later mythology. Tolkien revised parts of The Hobbit after developing the sequel.
The Lord of the Rings was published in three volumes from 1954 to 1955, while The Silmarillion appeared after Tolkien’s death in 1977. Those publication dates explain why neither is the answer to this question, even though both contain much broader Middle-earth history.