That last hand really hurts! I think you played it well.

First hand, I put him on AK. There is a possible flush draw on the flop and he bets small to try to see a cheap card, knowing that you raised preflop. Then he keeps calling, doesn't hit, but smell some weakness and scare you out. Slowplaying a set against a possible flush draw wouldn't be smart, but of course TT or QQ is also very possible.