This paper presents an obstacle-avoidance based approach for the control of MicroBioRobots (MBRs) using electric field. A MBR is an integrated cell-based robotic system, each of which consists of a SU-8 microstructure blotted with swarming bacteria. The concept of the MBR is to utilize inorganic structures as platforms to harness the collective propulsive power from the biomolecular motors of bacteria. We previously demonstrated motion control of MBRs using electric field. However, in the presence of obstacles in the workspace, the electric field can be distorted. In this paper we evaluate the distortion of electric field around obstacles and develop a motion control algorithm that takes the distortion into account. Our obstacle-avoidance method enhances the controllability of the MBRs by allowing them to avoid collision with static obstacles in real time. Artificial potential field was used in our approach to generate the objective function regarding the controllability of the MBRs under electric field. Furthermore, we use COMSOL Multiphysics engineering simulation software to model an electric field applied across the testbed to characterize distortions of the field around the boundaries of static obstacles. We demonstrate the feasibility of our obstacle avoidance algorithm through experiment and simulation.