Advances in precise focusing of colloidal particles in microfluidic systems open up the possibility of using microfluidic junctions for particle separation and filtering applications. We present a comprehensive numerical study of the dynamics of solid and porous microparticles in T-shaped junctions. Good agreement with experimental data is obtained on the location of particle-separating streamlines for single solid particles with realistic parameters corresponding to the experiments. We quantify the changes in the position of the separating line for porous, partially penetrable colloids. A prediction of the full phase diagram for particle separation is presented in the case of two successive particles entering a T-junction. Our results suggest the intriguing possibility of using the one-and two-particle T-junctions as logic gates.