The US House passed legislation Thursday to keep the government funded beyond the Friday midnight deadline for when the current budget was set to expire, narrowly averting a shutdown for the fourth time in recent months as a divided Congress has failed to reach an agreement on a new spending plan.