This work envisages using a density-based lattice topology optimization technique to achieve the hip bone’s optimal porous yet stiff microstructure with pre-defined lattice cells. The optimization uses a weighted multi-load approach to minimize the compliance or bone strain energy from eight phases of the walking gait cycle and studies to what extent the walking gait influences the hip bone microstructure. Mass constraints are imposed in the optimization formulation to ensure the optimum hip bone model weighs the same as that of the natural hip bone. Three lattices with cubic symmetry (cubic, mid-point and octet) and one lattice with transverse symmetry (octahedral) are used to optimize the hip bone microstructure. The optimization technique also replicates the anisotropic lightweight architecture of the natural hip bone. The resulting functionally graded porous hip bone models show visual similarities in the microarchitecture to the natural hip bone and are qualitatively compared to that available in the literature. The octet lattice cell offers the highest stiffness amongst the four lattice cells. No such prior work has been carried out to study the microstructure of hip bone using the method of topology optimization. This work has potential applications in pelvic reconstruction after tumour resections and fractures. © 2023, The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.