Inverse homogenization in combination with contact modeling, topology optimization and shape optimization is used to design metamaterials with optimized macroscopic response. The homogenization assumes length scale separation which allows the non-linear macroscopic behavior to be obtained by analyzing a single unit cell in a lattice structure. Self contact in the unit cell, which is modeled using a third medium contact method, is leveraged to obtain a complex homogenized response. The inverse homogenization problem is initially formulated as a topology optimization problem, where the macroscopic stress–strain behavior is tuned to our liking. However, it is well known that boundary phenomena are difficult to model in topology optimization and that interface modeling is crucial to accurately analyze contact. For that reason, the boundary representation of the topology optimized design is extracted and used as initial design in a subsequent shape optimization. The behaviors of our designs are verified by performing rigorous post-processing analyzes using conforming meshes and conventional contact formulations.