1) 40/20/3 isn't really LAG, especially with only 40 hands. It's slightly loose preflop, but could be short term variance. It's not overly aggressive for a 6 max game though. At worst at this stage I'd call him SLAG, pending further developments.
SB, on the other hand, is terrible - even with only 40 hands 95/47 is bad, and LAG preflop. 1.7 says he gets rather passive postflop
2) I probably raise my 88 preflop, but just checking out of the BB is fine here as well - and I will play it that way at times.
3) The flop raise is fine. Once HJ 3 bets you have to start asking what he's 3 betting with, the possibilities at this stage are fairly wide.
4) The turn is a great card for you, but HJ goes and 3 bets you again. At this stage you have to figure he has a made hand. He doesn't fear the straight, even though there's 4 to the straight on board, so I would suspect he has at least an 8. What he has to go with the 8 is up in the air, but if we say he has an 8 we know it's red. He has an aggression of 3 so far, which is high, but not maniac level by any means. How often has he been folding to flop and turn bets?
5) the river:
Yuck, that's a bad card, and a good card. If someone had J8 you just got a split as opposed to a loss. If the flush hit you're in trouble. You say you're getting 23 to 1, but I figure that it's a split pot here, at best. He raised 2 people here, he's not bluffing. Now he may be overplaying an 8 for a split. Against a basic unknown you have to call this - especially closing the action. Against a known player you may be able to fold this sometimes, but you need a good read.
Now, when you could have gotten away - there's only 1 place you could have escaped this hand, possibly, and that's on the flop. Your hand on the flop is not terribly strong, and the pot at that stage is tiny. When SB bets you have 2 choices, raise (as you did) or fold (actually a call, goven the textrure, is also defensible here - but I prefer raise or fold. If I play I want to try and get it HU against a bad SB).. A raise is defensible, but so is a fold. If you had the

then a fold would be much less desirable, but given the fact that you have no diamonds, no overpair (not even top pair) and a gutshot that may be subject to redraws, or even a flush if the

hits, and the fact that even an 8 can't be considered a great card (both flushes and straights are possible) a fold is a viable option here. It may even be the better option.
If the pot was bigger (say you had raised preflop) then that option starts to shrink in value, but the way the hand played out a flop fold was certainly viable (and defensible).