Using inverter ic to make my circuit switch between USB and Battery power
What you are looking for is called PMIC - Power Management IC. The MCP1640 is a weaker version of real PMIC. Several companies (Linear, Texas Instruments, Cypress) offer a whole line of ICs that are charging a Li-Ion battery when external power is available (while feeding the system directly), and automatically turn to battery booster when external power is lost. These circuits also can limit the power they take from USB in accord with the standard, and some even might negotiate power within BC1.2 specifications. As an example, take a look at this IC, BQ24296. It is likely that you will find a better fit to your particular need from the sizable lineup of their products.