Constructing two-dimensional (2D) van der Waals (vdW) heterostructures is an effective strategy for tuning and improving the characters of 2D-material-based devices. Four trilayer vdW heterostructures, BP/BP/MoS2, BlueP/BlueP/MoS2, BP/graphene/MoS2and BlueP/graphene/MoS2, were designed and simulated using the first-principles calculation. Structural stabilities were confirmed for all these heterostructures, indicating their feasibility in fabrication. BP/BP/MoS2and BlueP/BlueP/MoS2lowered the bandgaps further, making them suitable for a greater range of applications, with respect to the bilayers BP/MoS2and BlueP/MoS2, respectively. Their absorption coefficients were remarkably improved in a wide spectrum, suggesting the better performance of photodetectors working in a wide spectrum from mid-wave (short-wave) infrared to violet. In contrast, the bandgaps in BP/graphene/MoS2and BlueP/graphene/MoS2were mostly enlarged, with a specific opening of the graphene bandgap in BP/graphene/MoS2, 0.051 eV, which is much larger than usual and beneficial for optoelectronic applications. Accompanying these bandgap increases, BP/graphene/MoS2and BlueP/graphene/MoS2exhibit absorption enhancement in the whole infrared, visible to deep ultraviolet or solar blind ultraviolet ranges, implying that these asymmetrically graphene-sandwiched heterostructures are more suitable as graphene-based 2D optoelectronic devices. The proposed 2D trilayer vdW heterostructures are prospective new optoelectronic devices, possessing higher performance than currently available devices.