I own two XB40's and can't say they've ever distorted at max volume(connected to an ipad and various android phones) even with the sony music app's bass and treble pushed to full they get near to full volume before the sound starts to break up, eg; since they don't have tweeters the bass can interfere with the mids and highs but that is more with bass heavy material. On a side note there are allot more out the box revealing speakers out there, but with some careful equalisation the sony's put out a decent sound and go very loud for a wireless battery powered speaker, I put them up against JBL extreme, UE Mega Boom and so on but after some messing around with them found the XB40's to be more beastly for my needs, lol don't buy the sony's if you're into refinement I say.
I heard a live a comparison between the two myself. though I can see where you coming from, I just found the 20 to sound a bit more 'tinny'. I quite enjoyed the xb-40 but you can't go wrong with the xb-20 Unless you are talking about a refurbished tv from centre direct, I would not really recommend buying the xb-40 for tv purposes. It was never intended for that, so sound represenetation will not be as accurate or apporiapte for films or tv shows.
The XB20 is better than the 40, I use mine as a Music Speaker in the Kitchen as it is so loud and clear. The XB40 I got rid of because it has distortion at high volumes and I think the 20 just was a lot better to listen to. I'd definitely buy the 20 and again it can easily fill a medium size room, I was surprised..... but I wouldn't use it as a TV speaker... you can as it's way better than any built in TV speaker, but I dunno, I guess for £40 quid you cannot go wrong.
What about for a TV ?
I have the xb20, sound quality is excellent, this range has a separate sub at the back, decent bass to, and water proof, build quality is amazing really solid device, also supports LDAC. I have brought speakers and soundbars from Sony refurbished, they are like new can't tell the difference and come with full warranty.