First you should be focusing on where your head is supposed to be when shooting for a takedown. Your head should almost always be in his stomach or chest, never to the side. Your head moves to the side as you near completion of the takedown and you're basically in side control. Shooting in and getting pulled into guard usually means you also didn't have your hands behind his knees and you didn't throw the legs to the side.
The simplest defense to the guillotine is to tripod, apply as much pressure as you can onto you head and on the shoulder connected to the persons body, hand fight, and then start pushing on their knee to loosen the guard and then either same side knee cut or cross knee cut. If they're guard just opens up then simply move to side control. Just be careful they don't pull the knees in and then sweep you over into mount or onto your sides where you'll still end up getting choked.
It's situational really on which cut you use, but can also come down to preference. If you same side knee cut you just need to make sure you keep the leg pinned down so you can backstep the other leg so you don't get caught in half.