Your dialysis machine is programmed with how much fluid you need to have removed, according to how much you have gained. Toxin removal works the same way, through diffusion. A clean solution of dialysis is placed in the peritoneum. Toxins from the blood, cross through the peritoneum, which works as the semi-permeable membrane or filter, and enters the dialysate on the other side of the peritoneum. This dialysate is later discarded and fresh dialysate is put in, just as with hemodialysis.
Fluid removal works a bit differently with peritoneal dialysis.
Into the dialysis solution glucose is incorporated. This glucose, depending on the amount, draws out water from the blood, and into the dialysate. Again, this dialysate is discarded with the excess fluid, and the process starts again. Osmosis allows only the smaller molecules to pass through a membrane. I hope this has helped to somewhat de-mystify the way dialysis works.