You can eliminate the diode voltage drop using a P-channel MOSFET, but there are some subtleties that could catch you out:-
The MOSFET has an internal 'body' diode connected between the Source and Drain. This can perform the same function as your diode, but to get the diode pointing in the right direction the Drain/Source polarity must be reversed.
If the MCU only outputs 3.3V then the MOSFET's Gate voltage must be raised up to meet the Source voltage. This level shifting can be done with another FET or bipolar transistor, which can also conveniently invert the signal so the FET turns on when the MCU's digital output is high.
The circuit looks like this:-
simulate this circuit – Schematic created using CircuitLab
So far so good. However this scheme has a problem - if external USB power is applied while the FET is turned on then current will flow from the USB port into the battery until the MCU switches the FET off. Also the difference between internal and external USB power is then quite small (~4.5V vs 5V) so the MCU might have trouble determining when external USB power is present.
If you add a booster to get 5V from the battery then the voltage difference could be so small that it is impossible to tell whether external power is present. One solution might be to feed both battery and USB power through the booster, with diodes in series with each source to isolate them from each other. You can then measure USB input voltage without interference from the battery, while the booster produces a full +5V from both power sources.
simulate this circuit
In this scheme you would have one USB port to get power from as a device, and another to put power onto as a host. If you want to do both jobs with a single USB port then you are creating something similar to USB On-The-Go, so it might be easier to use a dedicated OTG controller chip.