The Lord of the Rings

 was a book series by J. R. R. Tolkien. I.M. Foreman had been reading The Lord of the Rings shortly before meeting the Eighth Doctor. She said that it was very long, but she liked the final line. When the Doctor mentioned travelling with someone named "Sam", Foreman was reminded of a character from Rings. The Doctor, for his part, was reminded that Fitz had been talking about Rings. (PROSE: Interference - Book One)

In Stockbridge, Andrew Harper asked Nyssa if the novel she was writing was like Lord of the Rings. (AUDIO: Autumn)

Astrolabus forced the Sixth Doctor to quote the book in The Cabinet of Astrolabus. (COMIC: Once Upon a Time Lord)

While working at a garden centre, Fitz had a conversation with a woman and convinced her that the character of Frodo had been named after a woman the author, J. R. R. Tolkien, had had a relationship with. (PROSE: The Taint)

Behind the scenes

 * Individual characters from The Lord of the Rings have also been referenced, Rose Tyler once called Chip "Gollum" (TV: New Earth), and the Eleventh Doctor mistakenly called himself "Gandalf", whilst actually describing Yoda, from Star Wars (TV: Meanwhile in the TARDIS). Neither explicitly makes the connection between these characters, and either J. R. R. Tolkien's books or the film adaptations, however.
 * Actor Ian McKellen can be seen dressed as Gandalf in the 50th anniversary story, The Five(ish) Doctors Reboot.