In most text books, they want you to do a force balance on each individual mass, then add the equations together to cancel all the tensions and solve for acceleration. Since the pulley is frictionless and the mass of the rope is negligible, you can treat the entire system of masses as a "caterpillar" with part of its mass hanging off and part of it dragging along: Here is the overall equation for the system:
a = FNet/msystem = (M1g - M2gμ - M3gμ)/(M1+M2+M3) (This is the a for all the masses)
In order to solve for tensions, you need to apply Newton's 2nd Law for each mass (picking the system that allows the easiest calculation:
M3 : T(a) - M3gμ = M3a or T(a) = M3(gμ+a)
You can do the same thing for M2 or M1 or (cleverest) (M2+M1) in order to solve for T(b)
M1+M2: T(b) - (M1+M2) = (M1+M2)a
From M2, you could use T(b) - M2gμ - T(a) = M2a which will give same T(b)
Good luck!