Militants make fresh gains in northwest Pakistan