You have a drawing hand, which is playable from late position, however, after the button calls, you are OOP the entire hand, which may become difficult if you semi-miss as you did.
so pretty much there is nothing wrong about folding this hand pre depending on the table dynamics.
If you play it, you cannot really love the flop. You hit middle pair and have a weak kicker + a gutshot.
So tbh I don't mind check folding here, as your plan with such a hand Should be to extract max value if you hit big (2 pair +) and play it cautiously if you don”t.
The check OTF is ok, and unfortunately he is giving you the right price to call (1:5), so we can call. He may have anything from Air (A high) to Top pair to 2 pair (unlikely) or a set or (more unlikely) a draw.
Turn further deteriorates your dilemma, you are now open ended, and he again gives you a good price (1:4).
If you are more on the tighter side this is a fold, but for that price you can peel one more street and re evaluate OTR.
River: You show weakness for the third time and now he barrels Big time.
No way you can call her. You missed, he fires, you fold – as easy as that. If you hit two pair this may be a more difficult decision, but with this board it is a no brainer.
I put him on a J. And even if he has A high. Triple barrelling on this board seems super strong, so if it was a bluff, it was a very well timed one.