The use of rectangular-shaped microstructures at the front surface of a solid target is shown to improve gamma-ray generation by 2–3 orders of magnitude, compared to the case of a planar target, when irradiated by laser pulses with an intensity of 1.13 × 1022 W cm−2. Also, it is observed that the laser energy absorption rate increases more than 10 times, up to 57%. The analysis of the simulation results suggests that in the case of relatively narrow microstructure elements, the gamma-ray generation mechanism is similar to that in the case of laser pulse normally incident onto a planar target, but with differences in the electron trajectories. The optimal dimensions of rectangular-shaped microstructured target have been found with the help of 3D particle-in-cell simulations.