You posted this in the tournament section, but I assume, this is a hand from a $1/3 live cash game?
Preflop
Definitely a standard defend to a little over a 3BB open raise from BTN.
Flop
This is a pretty big bet of almost full pot, but even so I think, you have to continue with second pair and a BDFD.
Turn
This was obviously a great card, since you now beat all overpairs and top pair
hands. You also gained
equity against a flopped straight, and his draws lost a lot of equity. I do think, this card gets checked back a lot, so I think, there is a lot of merit to donk betting here. If you do so, you are however representing pretty much exactly the kind of hand, you have, so I dont hate sometimes checking as well.
River
Another great card not only because you filled up and now have the third best possible boat, but it also potentially gave him a flush, in which case you can now win a big pot. Pot is $60, and apparently you have $250 left behind. Depending on your read on the opponent and his tendencies, you can both lead out for value or get more tricky and try to go for a check-raise.
If you are going to lead, I would bet more than just $20 into a pot of $60. I cant imagine, that $20 get called twice as often as $40. So I think, this is the first real misstep in the hand. However luckily for you he now raise, and of course you have to put in a 3-bet. After his raise (and your hypothetic call of it), the pot is now $60 + 2 x $40 = $140 and you make it $100 more for him to call.
I think, this is a pretty reasonable sizing, but it does depend a lot of, what you think of this player? If he is never going to fold a flush, even on a paired board, then its fine to jam for $210 more, although it is an overbet of 1,5X the size of the pot. But if he is more likely to sigh-call $100 instead of $210 with a flush, then I think, your sizing is fine.
Results
You definitely made the most, you possibly could against his actual holding. Its a pretty big mistake by him to raise top pair on the river, but apparently he misread your sizing as weak. And then as an even bigger mistake he was unable to raise-fold a marginal top pair hand. He should clearly just have called your $20 and taken a showdown.