He was pretty useless after The Best of Both Worlds. Probably would've been more fondly remembered if Frakes had left the show after the season four premiere.
I wouldn't say useless, because I like Riker, but his character growth was stunted after that.
I think a good "out" would have been introducing Thomas Riker, his transporter clone, earlier in the series, and either writing William Riker out of the show as finally getting a command and having him choose a ship over Troi, or killing William Riker off altogether, and have Thomas Riker "join" the cast.
Then you would still have Riker on the show, just a different version of the character, with more room for character development, the "second chance" for Troi to have a relationship with Riker would make sense, plus you wouldn't have the problem of someone who should be a captain, hanging around as "co-Captain" of the Enterprise.
Also, since Tom Riker was only a Lieutenant, we could have seen him grow as an officer, earn a promotion or two during the rest of the show and perhaps have a dynamic where Tom Riker is trying to live up to William Riker's Legacy (especially if he had been killed off) and maybe going out if his way to overcompensate and even trying to be a better officer than William Riker, and a better boyfriend to Troi.
Instead, they wasted Tom Riker on a one-off episode, where he steals the Defiant but doesn't get away with it and he presumably spends the rest of his life in a Cardassian penal colony.