Preheat the oven to 350ºF (180ºC) and line a 9×5-inch (23×13 cm) loaf pan with parchment paper, for easy removal.
In a skillet, heat the olive oil over medium-high heat and cook the onion and garlic until it's soft and lightly browned, for about 3-4 minutes. Then, remove the skillet from the heat and set it aside.
Add the lentils to a large mixing bowl and blend them using an immersion blender, food processor, the back of a fork, or a potato masher.
Incorporate the cooked onion and garlic along with all the remaining ingredients into the same bowl. Then, mix until well combined. For a smoother texture, you can use an immersion blender or a food processor.
Press the mixture firmly into the prepared loaf pan. Alternatively, you can place the mixture onto a lined baking sheet and shape it into a loaf with your hands. However, using a loaf pan is easier and more convenient.
To make the glaze, simply mix the ketchup and brown sugar in a bowl until well combined.
Spread the glaze evenly over the top of the vegan lentil loaf and bake for 45-50 minutes.
Remove from the oven and allow the vegan lentil loaf to cool for at least 15 minutes before removing it from the loaf pan. Slice, serve, and enjoy!