In this paper, we design the uniaxially and biaxially strained black phosphorus (BP) photodetectors. Different strains applied in the zigzag or armchair direction can effectively tune the direct band gap of 5-layer of BP. The optical field intensity is modeled to determine the absorption for the BP layer. The strain effect on the band structure of BP is investigated using first-principles method based on density functional theory. The cut-off wavelength of strained 5-layer of BP pin photodetector is extended to middle infrared range with a high responsivity of 66.29 A/W, which means that the strained black phosphorus photodetector provides a new approach for the middle-infrared range optoelectronic devices.