OK, I looked up the Texas Code of Criminal Procedure (go to
http://www.capitol.state.tx.us/statutes/cr.toc.htm and type MDMA in the search engine).
We find that MDMA is in 'Penalty Group 2'. Searching 'Penalty Group 2', we find that the penalties for posession are as follows:
For manufacture or delivery:
"An offense under Subsection (a) is a felony of the first degree if the amount of the controlled substance to which the offense applies is, by aggregate weight, including adulterants or dilutants, four grams or more but less than 400 grams." [This is the second worst kind of felony, out of 4, e.g. state jail, second degree, first degree, and "10 years [min] to 99 years"].
It seems to me that 50 pills would equal at least 5 grams (if each pill is 100mg).
It would be a second degree felony if he just got done for posession (or third degree if it was less than 4 grams).
The punishment for first degree felonies is 5-99 years.
The punishment for second degree felonies is 2-20 years.
Obviously, IANAL. I am not even American, so I may be misunderstanding your legal system. I'd be grateful if someone more knowledgeable than I could look at the link I posted, and confirm.
But it certainly seems to me that your friend should get a fucking lawyer, and make a real effort to find a way of showing that he wasn't dealing.