MEX can be an utter gong show, or not. It depends on the time of day, the terminal, the airline...
Assuming this is all on one ticket, I would be personally comfortable with a three-hour connection. If you're connecting within the same terminal, it's a pretty easy process. If you have to change, it'll be something of a pain because you'll have to take a bus between terminals and go through security again.
If it's not all on one ticket, may the Schwartz be with you.
EDIT: I originally missed that you said you're coming up on AM before leaving on BA. That will presumably mean you're arriving in T2 and departing from T1, so expect to hustle between the two. I don't know what gates BA tends to use in T1, but if it uses the same area as the US airlines (likely), it's a bit of a hike from security.