switching power sources
Consider copying the Arduino Uno reference design.  This is part of that schematic showing the MOSFET used to turn on / off the USB power when the barrel jack power source is active: