I have read in various places that Lord Dunsany's fantasy writings in the early twentieth century—which I have read some of and would generally recommend—had a profound influence on The Lord of the Rings. However, no one ever cites any sources on this, and Dunsany is unfortunately one of those authors whom it is very difficult to find much about on Google.
It seems plausible enough, having read The King of Elfland's Daughter, that Dunsany's elves and their obsession with the passage of time might have influenced Tolkien. But it seems just as plausible that they both drew elves from common folklore and literary themes.
By 1937, Tolkien had read widely enough in the literary fantasies of Lord Dunsany (1878-1957) to feel competent to judge his nomenclature unfavorably (Letters, 26). In a 1972 letter, he alluded to Dunsany's tale of the rival idols Chu-Bu and Sheemish (Letters, 418). Tolkien's poem The Mewlips may be a recasting of the plot of Dunsany's "Hoard of the Givvelins." Lyon Sprague de Camp records, in Literary Swordsmen and Sorcerers (243), that Tolkien referred disparingly to Dunsany's "Distressing Tale of Thangobrind." Thee three stories are found in the collection The Book of Wonder (1912). There is little reason to suspect that Dunsany influenced Tolkien appreciably. Dunsany proffered many of his fictions as "dreams," even titling a typical colleciton of them A Dreamer's Tales, but Tolkien debarred stories with a dream explanation from Faerie ("On Fairy-stories" in Reader, 42) and never referred to Dunsany publicly. In a sense, Dunsany is an anti-Tolkien. Where Tolkien esteemed the "Elvish craft" (Reader, 70) that creates a convincing secondary world, Dunsany's pervasive irony and unreality suggest skepticism even about the value of the "primary world."
This is as good a summary of the subject as you're likely to get, although I'd like to add a couple things. We do know Tolkien was at least familiar with some of Dunsany's work, but we don't know when he read it because he rarely spoke about his recreational reading. This is in direct opposition to H. P. Lovecraft, who wrote quite a bit about his appreciation for Lord Dunsany and the influence that his fantasy fiction had on his early works.
Some folks erroneously assume that because Dunsany came first he must have influenced Tolkien, but this isn't always the case - and the elves in most of Dunsany's work (such as "The Kith of the Elf-Folk") are quite different from his later depictions in The King of Elfland's Daughter (1924) - or from other contemporary depictions of elves, such as E. R. Eddison's The Worm Ouroboros (1922) or Poul Anderson's The Broken Sword (1954). So whatever influence Tolkien might have absorbed from Dunsany in the 1930s when he was writing The Hobbit and laying the groundwork for The Lord of the Rings, he was also working within a wider tradition of elves and fantasy in general.
u/ItsAllFolklore and u/AncientHistory have some answers related to this in threads like: