I have been playing poker for only 6 months now, and i am trying to learn how to play different situations. This situation is quite rare but i had it happen to me a few times lately.

(sorry for the bad format, this happened on bodog poker so the hand history converter doesnt work)

i am in late position. a guy raises 5xBB pre-flop, a guy calls in middle position and i call with pocket 7s
the flop comes T7T.
the first guy bets 3/4 of the pot.
second guy fold, i call.
the turn comes T.
the first guy checks, i raise 1/2 pots, he calls.
river is 3
checked to me i raise 1/2 of pot again, he reraise all-in for twice the amount of the pot. (my stack is as big as his)

i folded because any higher PP beats me.
what would you do there?
or would you play it differently?