The wood has a lot to do with it. It's a common thought that the denser the wood (or other material), the better the sustain, but Adrian Legg in his 'make your own electric guitar' book [paraphrased, can't remember exact title] quite explicitly says he doesn't believe this, and give the example of 2 identical Strats, one ash, one alder, and the lighter alder one sustaining better.
Having said that, my tele (pretty much solid Tas Oak, which is the sonic equiv. of Ash)weighs a tonne (4.5kilos) and has amazing sustain. The heavy bridge & string through body, like Lew says, probably has a lot to do with it, though I reckon having a tight neck-to-neck-pocket join has a lot to do with it too. Adrian Legg in 'Customising your Electric Guitar' talks about how his experimental heavy brass bridges, combined with string-through-body, improved sustain.
Another thought - I always thought that part of the reason Les Pauls have a maple cap was to improve sustain.