I already know the answer to this one.. but could use some advice of how to avoid this. It's happened more than once!

Hold'em No Limit ($0.05/$0.10) - 9 player - VILLAIN seemed loose to me.

Seat #8 is the button
Seat 1: VILLAIN($5.55 in chips)
Seat 3: HERO($1.70 in chips)
VILLAIN: posts big blind $0.10

*** HOLE CARDS ***
Dealt to HERO [Ks Kh]
HERO: raises $0.20 to $0.30
VILLAIN: calls $0.20
Everyone else folds

*** FLOP *** [9h 3h 5s]
VILLAIN: bets $0.10
HERO: calls $0.10
*** TURN *** [9h 3h 5s] [7c]
VILLAIN: bets $0.30
HERO: calls $0.30
*** RIVER *** [9h 3h 5s 7c] [4d]
VILLAIN: bets $4.85 and is all-in
HERO: calls $1 and is all-in

VILLAIN ended up with pocket 3's and the pot and all my money.

What should I have done differently?

Thanks,
Tim