Thanks for the comments all. Having reflected on it overnight and looked at the stats, I realise that I am guilty of mirror-thinking here. My own range for that betting sequence would be 22-99, of which, having seen the flop, there are 3 combos which beat me, 1 combo which is a draw and 36 combos where I lose. So if that was correct, I would be ahead 90% of the time, which I think would have justified my line, save that the bet is too large: in that scenario I don't need to protect.
But then what's his actual range? He puts money in with 39% of hands overall, but that does that mean he calls with 39% of hands here? Or does he call fewer from MP? Or does he call more when there's no action ahead of him? Then how many hands does he fold to a raise behind? It will frequently happen that there's a raise behind if he open limps from MP, and I can't see him giving up more than half of his bets. It's also possible that he just wants to see the flop, and calls my raise with any hand. So I think his actual range is something like 20-40% of hands. Call it 30% for the sake of argument. He has PFR 2%, so the top 2% of hands are not his range here. Putting 30/2 into Equilab generates a range 99-55, A2s+, K5s+, Q7s+, J8s+, T8s+, 98s, A7o+, A5o, K9o+, Q9o+, J9o+, T9o. Of course that isn't his actual range, but it's probably as good an approximation as any. Putting in my cards and the flop against that range, Equilab calculates that I had 49% equity.
KingKas, I think you're wrong: he does often raise postflop. He has AF 3.2, which is why I call him aggressive, even though he is passive pre-flop. He also has 100% CB (which I could see at the table, although it's not shown here), so I considered that by analogy he probably raises here on almost any hand. (In fact, although I didn't know at the time, HM2 tracks a stat for how often a player raises after the other player misses a contibet, and he'd made the raise on 2 out of the 3 previous occasions.)
So where does that leave us? Is my pre-flop line correct? I could check and play my 9s for set value. But the advantage of raising is: (i) I might win at once, (ii) I'm likely to reduce the number of players in the pot, and I'm happier playing 9s against 1 opponent than 3, (iii) I'm representing a strong hand and could potentially win the pot with a contibet even if I miss the flop.
Then post-flop, there seems to be pretty general agreement that my line is incorrect. To answer nitrol's question, the reason I don't contibet myself that I believe (incorrectly, I now realise) that I'm well ahead, so I want to get more money into the pot. I don't expect weaker hands to call a contibet, but I do expect villain to bluff-raise with a weaker hand if I check. As Tomaloc observes, my bet sizing is incorrect in any case. From the analysis above, I now believe that I am about equal with villain, so contibet would be correct. Villain may put me on at least TPTK, so I hope he folds some better hands. He probably also calls draws (of which he may have many), in which case I should be ahead on the turn unless he completes. Size of contibet? If I had TPTK, I would usually make a pot-sized bet in an attempt to force draws to fold (or more realistically to get Villain to call with incorrect odds, which is profitable for me in the long term). So my instinct is that I should make a pot-sized contibet: this is both large enough to give Villain pause for thought and consistent with the hand I want to represent.
From the actual play, I assume that Villain would reraise, in which case I have to fold. (It doesn't seem that anyone thinks my fold was wrong here.)