I live in a large apartment building and had a moderate pharaoh ant infestation. I tried sealing off all their entry points with silicone and foam sealant, but they kept finding another way through. They are very small and can get through even the smallest cracks.
I tried a protein bait, but they didn't go for it. Then I tried these Terro baits. Initially I didn't think they would work as I put an ant right in front of one but it refused to go in. Then I put the bait on the ground in their trail and made a ramp up to the opening with mounting putty (aka Sticky Tak, Fun-Tak, etc). It took a few hours, but eventually the bait was swarming with ants. I put down 3 traps spread apart at different key entry points into my apartment, and refreshed them all after a week, though I'm not sure if refreshing them was actually necessary.
After 2 weeks their numbers appear to have greatly dropped, and I only see a small number of them at the traps every day. I imagine it will take a few more weeks to bring the number close to zero (hopefully). I'm not sure if I'll ever completely rid my apartment of these pharaoh ants as they are probably infested throughout the building in many different nests, but at least I seem to have a way of controlling them now. I now almost never see them on countertops or in cupboards where I keep food anymore, and they seem to stick to the areas around the traps (and likely go back and forth between the traps and their nests), so the situation is much much better. Even if I have to keep these traps out for many months, it's really not that big of a deal, as they are low cost and don't really get in the way that much.
These type of traps may not work for every type of ant, but for the pharaoh ants in my apartment building they seem to work well.
UPDATE EDIT: It's been about 3 months since I started using this Terro liquid bait on the pharaoh ants, and I now no longer see them at all, which is great! This could be temporary, as I have no control of what is happening outside of my apartment itself, but if they do come back I think they will be easy to deal with and control using these traps. I learned that it is best to refresh each trap every week, as the pharaoh ants seems to grow less interested in the traps over time. By the end of it I was only replacing 1 trap every week at a key entry point for the ants, so it's minimal cost. The liquid in the traps does progress from a pure liquid state to a gel over time. Maybe there is some sort of food attractant in the bait that dies out over time.
2nd UPDATE: It's been about a year now. These ant traps definitely help keep the situation under control, but I don't think I'll ever be rid of the issue as I have no control over anything outside of my apartment. Sometimes I can go weeks and even more than a month without seeing an ant, but they always seem to come back. I imagine they are festering somewhere outside my apartment. So I have just accepted putting these traps out every now an again to control the situation. Sometimes they are able to establish a nest in my apartment, but using these traps I have been able to get rid of any that pop up. I think the only way to fully eliminate the pharaoh ant issue is to have an exterminator bait the whole apartment building, which I don't think is going to happen anytime soon talking to the building superintendent.
3rd UPDATE: In addition to making a ramp with mounting putty up to the opening, I also put a thin layer of mounting below the front "legs" of the trap. This helps prevent the liquid from coming out the opening and also from getting onto the ant path inside the trap. Some traps are filled up more than others, and the ones that are topped up too much usually need this mounting putty "shim" to keep the fluid from flowing over where you don't want it to go. I also use a Q-tip to clean out the opening of liquid bait before I put it down, as this helps prevent ants from just gathering in a crowd at the opening rather than going inside the trap. I now no longer use regular scissors to make the trap opening, and now use aviation (sheet metal) snips. Scissors are fine, but the snips are better.