Try changing your clock speed to different values and see if they perform better; I've run into this before, and it seems related to the USB cabling.
i tried this. there is a situation i would like to point further, i have two similar boards, exactly similar in all aspects of components. one board i am able to program using miniprog3 while the other i cannot.it gives the error as " there was an error while programming the device. failed to re-aquire the device"
Also at the same time if i program them with the MIniprog2 that came with CY8CKIT-149 PSoC® 4100S Plus Prototyping Kit, the code successfully burn every time on both the boards.
If the two boards are exactly the same, then the issue would point to poor connections with the programmer imo.
Adjusting length of USB cable or SWDIO wire lengths to be shorter generally help in those cases, and reseating the programmer headers to make sure it didn't wiggle loose.
Depending on the code running on the device, and which "reset" choice you have enabled, application code on the board that is running might be interfering with the programming too.
Are you using RESET mode or Power Cycle mode to burn PSoC4?
If it was Power Cycle, kindly try RESET mode.
In addition, troubleshooting about PSoC programming, refer to: