The Return of the King
Legolas continues to be our main elf in the action of The Return of the King, though this time he has the added reinforcements of Elladan and Elrohir, Elrond's two sons. Legolas accompanies Aragorn through the Paths of the Dead and he is around at the Battle of the Fields of Pelennor and at Aragorn's coronation. But like the elves themselves, who are fading away from Middle-earth, Legolas mostly fades out of the action of The Return of the King.
One reason why Legolas gets so little to do plot-wise is that he's really sad. We're talking majorly bummed. Once he hears the sea for the first time at the Haven of Pelargir, he knows he will not be able to resist going into the West with other elves for much longer. Legolas sums up the elf situation in song:
I will leave, I will leave the woods that bore me;
For our days are ending and our years are failing.
I will pass the wide waters lonely sailing. (6.4.70)
Legolas knows that the elves are getting tired of Middle-earth and they need to move on. But it's still sad to leave your home for "lonely sailing." At least for now, Legolas still has things to keep his attention here, such as his friendship with Gimli and his work with Aragorn to replant the trees of Gondor.