Currently, solenoids are extensively utilized in various research fields due to their flexibility of fabrication and high magnetic field strength. However, the internal magnetic field of the solenoid itself exhibits some non-uniformity defects, which limits its application in some domains. In this paper, we propose a novel single-wound tightly wound solenoid structure with improved magnetic field uniformity. To optimize the magnetic field near the aperture of the conventional solenoid, an auxiliary solenoid with a gradually changing diameter is included at each end of the solenoid. By adjusting different parameters of the auxiliary solenoid, we mitigate the edge effect of the solenoid and enhance its overall magnetic field uniformity. The optimization of the auxiliary solenoids is achieved through artificial neural network techniques. Finite element simulation results with the optimized parameters show that the proportion of uniform areas can be improved by more than 5 times. The research results provide a reference for high-precision electromagnetic sensing applications based on solenoids.