Allow a minimum of at least three hours between the scheduled arrival time of your UA flight and the departure of your BA one.
Expect that you will have to wait for and collect your luggage at T2.
If you get lucky at IAH and a UA agent does check through your bags on separate itineraries, consider it a very good day.
On the return, again leave a minimum of at least three hours between BA and UA flights. BA agents in Milan will definitely not check your bag through to IAH. You will have to collect it at T5 and take it over to T2.